Hey all, I need a piece of code that if your not an admin will msg("You can't spray!") and if you are allows you to spray, when you try to spray.
If anyone could help I would be eternally greatful I know this should be a real simple script for someone more experienced with the GMOD hooks but unfortuately I am now and it would probably take me an hour or two to get it right...
[code]
function GM:PlayerSpray(Player)
if Player:IsAdmin() then
return false
end
Player:ChatPrint("You can't spray!")
return true
end
[/code]
Thank you very much!!
Anytime.
[QUOTE=Drew P. Richard;25407996]Anytime.[/QUOTE]
I just have to ask, this might be stupid, but, here it goes:
Where can I find a full list of all the variables(I think?) such as
GM:PlayerSpray.
Sorry if this is obvious.
Goto the gmod wiki and search for hooks.
[QUOTE=Drew P. Richard;25407706][code]
function GM:PlayerSpray(Player)
if Player:IsAdmin() then
return false
end
Player:ChatPrint("You can't spray!")
return true
end
[/code][/QUOTE]
Awful.
[lua]hook.Add("PlayerSpray", function(ply)
if ply:IsAdmin() then
return false
end
ply:ChatPrint("You aren't allowed to use sprays!")
return true
end)
[/lua]
Put it in garrysmod/garrysmod/lua/autorun/server/spray.lua, creating folders and files if they don't exist.
[QUOTE=_Undefined;25503576]Awful.
[lua]hook.Add("PlayerSpray", function(ply)
if ply:IsAdmin() then
return true
end
ply:ChatPrint("You aren't allowed to use sprays!")
return false
end)
[/lua]
Put it in garrysmod/garrysmod/lua/autorun/server/spray.lua, creating folders and files if they don't exist.[/QUOTE]
For PlayerSpray, you return true to block the spray, false to allow it - not the other way around.
[QUOTE=Jamie932;25512550]For PlayerSpray, you return true to block the spray, false to allow it - not the other way around.[/QUOTE]
Wow. Didn't know that. Thanks.
Pretty dumb though.
Sorry, you need to Log In to post a reply to this thread.