How to disable spawning props and other stuff for everyone
3 replies, posted
Hello. I am using a script to disable spawning props, vehicles, sweps, etc but the script is not working. It should be though.
hook.Add( "PlayerSpawnProp", "AdminOnlyPropSpawn", function( ply, model )
if !ply:Team() == "TEAM_ONDUTYSTAFF" then
DarkRP.notify( ply, 1, 4, "Only admins and above can spawn props!" )
return false
end
end )
Any help is appreciated!
ply:Team() doesn't return a string, it returns the players team index number.
https://wiki.garrysmod.com/page/Player/Team
You could use this instead: team.GetName
Example:
if( team.GetName( ply:Team() ) == "teamname" ) then print("Hello") end
should i put a ! in front of ply to check? Ex: if( !ply:Team() == TEAM_SOMETHING ) thenprint("Hello") end
Operator ! is the same as not. In that case, you can use it like this:
if !( ply:Team() == TEAM_SOMETHING ) then dostuff
or
if ( ply:Team() != TEAM_SOMETHING ) then dostuff
Sorry, you need to Log In to post a reply to this thread.