Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Test of a server command that makes the admin invisible
- --Inspired from Wizard, Nuggets, Soap and Superzilla's works
- --With the great help of Kennan
- ghost = {}
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(processid, game, persistent)
- main_timer = registertimer(20, "IsPlayerGhost")
- end
- function OnServerCommand(player, command)
- local t = tokenizecmdstring(command)
- local count = #t
- if t[1] == "sv_ghost" then
- GhostPlayer(player)
- return false
- elseif t[1] == "sv_unghost" then
- UnGhostPlayer(player)
- return false
- end
- end
- function OnGameEnd(stage)
- if stage == 1 then
- if main_timer then
- removetimer(main_timer)
- end
- for player = 0, 15 do
- if getplayer(player) then
- ghost[gethash(player)] = false
- end
- end
- end
- end
- function OnPlayerJoin(player)
- ghost[gethash(player)] = false
- end
- function OnPlayerLeave(player)
- ghost[gethash(player)] = false
- end
- function IsPlayerGhost(id, count)
- for player = 0, 15 do
- if getplayer(player) then
- if ghost[gethash(player)] == true then
- local z = readfloat(getplayer(player) + 0x100)
- writefloat(getplayer(player) + 0x100, z - 1000)
- end
- end
- end
- return true
- end
- function GhostPlayer(player)
- if ghost[gethash(player)] ~= nil then
- if ghost[gethash(player)] == true then
- sendconsoletext(player, "You are already in Ghost Mode!")
- else
- ghost[gethash(player)] = true
- sendconsoletext(player, "Ghost Mode Enabled!")
- end
- end
- end
- function UnGhostPlayer(player)
- if ghost[gethash(player)] ~= nil then
- if ghost[gethash(player)] == false then
- sendconsoletext(player, "You are not in Ghost Mode!")
- else
- ghost[gethash(player)] = false
- sendconsoletext(player, "Ghost Mode Disabled!")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement