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
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnProp]SANDBOX:PlayerSpawnProp[/url] and
[CODE]
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
[/CODE]
If you need more help, add me on Steam (I speak german too).
[QUOTE=Synix28;52505708][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnProp]SANDBOX:PlayerSpawnProp[/url] and
[CODE]
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
[/CODE]
If you need more help, add me on Steam (I speak german too).[/QUOTE]
full code?
[QUOTE=Buzzkiller447;52510627]full code?[/QUOTE]
[CODE]hook.Add( "PlayerSpawnProp", "Propforteams", function( ply )
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
end)[/CODE]
**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
[CODE]
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( ply:Team() == TEAM_CITIZEN ) then
return false
end
end)
[/CODE]
Multiple Jobs
[CODE]
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
[/CODE]
not working ;/
[QUOTE=Buzzkiller447;52522302]not working ;/[/QUOTE]
Show us the code which is not working, we are not magicians.
[code]local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)[/code]
There might 2 reasons why it doesn't work
1) You haven't placed it inside a server file
2) You have an add-on that already returns something in that hook, in that case we can't do nothing
[QUOTE=gonzalolog;52522627]There might 2 reasons why it doesn't work
1) You haven't placed it inside a server file
2) You have an add-on that already returns something in that hook, in that case we can't do nothing[/QUOTE]
con u say to me how i need to put this in??
[code]
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
[/code]
I put it in and its not working :/
hey i get this as a error [code][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
[/code]
[QUOTE=Buzzkiller447;52536699]hey i get this as a error [code][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
[/code][/QUOTE]
The TEAM enum you're using in the table doesn't exist.
there is the coding [code]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)[/code]
[editline]3rd August 2017[/editline]
[QUOTE=Sean Bean;52536741]The TEAM enum you're using in the table doesn't exist.[/QUOTE]
yes it is existing
According to the error TEAM_SCPOST is nil.
[QUOTE=Sean Bean;52536909]According to the error TEAM_SCPOST is nil.[/QUOTE]
this team is existing
okay i fixed it!
[QUOTE=Buzzkiller447;52545705]okay i fixed it![/QUOTE]
If you fix something then post how you did so. It might help people in the future that stumble across the thread.
okay i not fixed so how i should install the script?
[code]
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
[/code]
[QUOTE=Buzzkiller447;52545838]okay i not fixed so how i should install the script?
[code]
local DisableProps = {
[TEAM_CITIZEN] = true,
[TEAM_POLICE] = true,
}
hook.Add("PlayerSpawnProp", "DisableJobs", function(ply, model)
if ( DisableProps[ply:Team()] ) then
return false
end
end)
[/code][/QUOTE]
Put it in a .lua file in "/lua/autorun/server".
It should be shared or server
[QUOTE=gonzalolog;52545918]It should be shared or server[/QUOTE]
what you mean with that?
[editline]7th August 2017[/editline]
[QUOTE=txike;52545843]Put it in a .lua file in "/lua/autorun/server".[/QUOTE]
name the to?
Sorry, you need to Log In to post a reply to this thread.