Is there any way to disable Prop Spawning for Jobs like Citizens cant spawn props anymore?? I’d like to say thanks beforehand for anyone who’s willing to help me with this
Would we be helping or spoonfeeding? What have you tried before asking for help? Have you even bothered to do any research?
yes but i just only founded disable prop spawning for users
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
If you need more help, add me on Steam (I speak german too).
full code?
hook.Add( "PlayerSpawnProp", "Propforteams", function( ply )
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
end)
UNTESTED
I would recommend next time to try to do it on your own. I understand you maybe new to lua but try
You forgot a ).
One Job
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
end)
Multiple Jobs
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
not working ;/
Show us the code which is not working, we are not magicians.
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
There might 2 reasons why it doesn’t work
- You haven’t placed it inside a server file
- You have an add-on that already returns something in that hook, in that case we can’t do nothing
con u say to me how i need to put this in??
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
I put it in and its not working
hey i get this as a error
[ERROR] addons/customscp_items_by_buzzkiller/lua/autorun/disableprop.lua:3: table index is nil
1. unknown - addons/customscp_items_by_buzzkiller/lua/autorun/disableprop.lua:3
The TEAM enum you’re using in the table doesn’t exist.
there is the coding
local DisableProps = {
[TEAM_SCPZEST] = true,
[TEAM_SCPOST] = true,
[TEAM_SCPTD] = true,
[TEAM_SCPZFN] = true,
[TEAM_SCPZNS] = true,
[TEAM_SCP682] = true,
[TEAM_SCP106] = true,
[TEAM_SCPZSZ] = true,
[TEAM_SCPLR] = true,
[TEAM_SCPFM] = true,
[TEAM_SCPWAR] = true,
[TEAM_SCPAL] = true,
[TEAM_SCPES] = true,
[TEAM_SCPNW] = true,
[TEAM_SCPOTF] = true,
[TEAM_343] = true,
[TEAM_CLASSD] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
[editline]3rd August 2017[/editline]
yes it is existing
According to the error TEAM_SCPOST is nil.
this team is existing
okay i fixed it!
If you fix something then post how you did so. It might help people in the future that stumble across the thread.