This is a resource that prevents users from being able to run around, shoot, drive, whatever whilst they are in god mode.
An example of where this might be useful
You’re on a deathmatch server and, for some reason, scripthook is enabled and a user comes on the server, enables god mode, and starts ruining the deathmatch and they’re at an unfair advantage. This script will freeze the player and the vehicle (if they are in one), and prevent them from shooting.
Is this the most amazing script to ever be released to this forum? No, not by far. This is a simple script that didn't take me long at all to create, I thought I would upload it to the forum and let people use it as a contribution to the community. I thought something like this had already been created, that's why I didn't initially upload it when I started working on it. Anyway, I hope you enjoy this script and I hope it can prove to be effective in your servers.
Thanks,
Zeemah.
If you encounter any bugs (which there shouldn’t be) please report them by either making an ‘Issue’ on the GitHub repository or on this topic. Thanks !
So, this detects people that uses godmode and does freeze them?
well done.
Maybe a kick function after a certain time, like 2 minutes or something would be also a good feature (For people that does not want to read because of whatever)
AAND maybe a bann feature too, but I think this would be too much.
If invincibility is detected on a player, it will freeze them, freeze the vehicle they are driving if they are in one and it will disable player firing – so they won’t be able to shoot.
Kinda want to keep this simplistic, but, if people want this feature then I will add it.
Would rely on some other script unless the ban would be temporary and it would include storing the identifiers somewhere. I don’t really want this to have dependencies.
the storing could get saved into a log.txt file, no dependency needed thatfor.
And I like it as simple as it is, so keep up the work
If you’re interested into writing a log.txt file look at this:
function textWrite(text)
log = io.open("resources/"..GetCurrentResourceName().."/log.txt", "a")
if log then
log:write(text)
else
print("Log file doesnt exist")
end
log:close()
end
not sure how to read it but I think it should be able to read with the default read
function from Lua…
Citizen.CreateThread(function()
while true do
local ped = PlayerPedId()
local player = PlayerId()
if isInvincible then
DrawLabel("~r~You are currently in godmode which is ~h~prohibited~h~ on this server, disable it now.")
FreezeEntityPosition(ped, true)
DisablePlayerFiring(player, true)
if IsPedInAnyVehicle(ped, false) then
FreezeEntityPosition(GetVehiclePedIsIn(ped, false), true)
Citizen.Wait(60000) -- wait 1 minute
DropPlayer(source, "Godmode isn't allowed on this server!") -- Drop the player after 1 minute
end
else
FreezeEntityPosition(ped, false)
if IsPedInAnyVehicle(ped, false) then
FreezeEntityPosition(GetVehiclePedIsIn(ped, false), false)
end
end
Citizen.Wait(0)
end
end)
I’m also aware that some menus don’t actually use SET_PLAYER_INVINCIBLE or so, but just constantly set the player’s health to 200 or whatever. I’ll work on an update that will check it menus are doing this.
+ Added the ability to check for staff - this is done via ace permissions. Just set `ace_perm` to whatever ace you want. Add the ace via `add_ace <identifier> <ace here> allow`.
+ There is a check that occurs every minute, it checks whether players have the ace specified, if they do, it will trigger a client event and toggle a bool which will allow them to be invincible.
Download
Bugs/Issues
Report them on this topic or make an ‘Issue’ on the GitHub repository.