• Max Jobs Limit
    15 replies, posted
Max jobs limits for darkrp, need help Here my example code of sv_maxjobs.lua [LUA] local MAX_POLICE = 0 function CalculateMaxJobs() local TotalPlayers = table.Count(player.GetAll()) if TotalPlayers >= 40 then MAX_POLICE = 8 elseif TotalPlayers >= 30 then MAX_POLICE = 7 elseif TotalPlayers >= 20 then MAX_POLICE = 6 elseif TotalPlayers >= 10 then MAX_POLICE = 5 elseif TotalPlayers < 10 then MAX_POLICE = 3 end end hook.Add("PlayerInitialSpawn", "CalculateMaxJobsOnSpawn", CalculateMaxJobs) hook.Add("PlayerDisconnect", "CalculateMaxJobsOnDisconnect", CalculateMaxJobs) hook.Add("InitPostEntity", "CalculateMaxJobsOnStartUp", CalculateMaxJobs) [/LUA] My problem is when i paste MAX_POLICE to shared.lua it doesn't work. Help, how to make this work, because i can't understand.
What is the point of this? You can do this in shared.lua..
Make jobs max limit depends on connected players
[QUOTE=Xyntax;39596708]What is the point of this? You can do this in shared.lua..[/QUOTE] HE want when there are 10 players on the server there can be just 3 cops if there are more then 10 then 5 cops if more or equal to 20 then 6 cops and so on so on.
[QUOTE=R@Rdeathmatch;39596771]HE want when there are 10 players on the server there can be just 3 cops if there are more then 10 then 5 cops if more or equal to 20 then 6 cops and so on so on.[/QUOTE] Yes you right
[QUOTE=R@Rdeathmatch;39596771]HE want when there are 10 players on the server there can be just 3 cops if there are more then 10 then 5 cops if more or equal to 20 then 6 cops and so on so on.[/QUOTE] Ow sorry, didn't read it clear. Well, i like the idea but i can't help.. :/
Isn't this feature already available in the form of a percentage?
lua_error try using this instead [url]http://wiki.garrysmod.com/page/Libraries/team/NumPlayers[/url]
The issue is that you made MAX_POLICE local, so unless it's actually in your shared.lua file you will not be able to reference it.
[QUOTE=Annoyed Tree;39599240]Try changing [lua]local MAX_POLICE = 0;[/lua] To [lua]MAX_POLICE = 0;[/lua][/QUOTE]
Why aren't you just setting RPExtraTeams[TEAM_POLICE]["max"]?
[QUOTE=Banana Lord.;39614008]Why aren't you just setting RPExtraTeams[TEAM_POLICE]["max"]?[/QUOTE] This looks like PERP code to me.
[QUOTE=Lerpaderp;39615378]This looks like PERP code to me.[/QUOTE] it's not [editline]17th February 2013[/editline] [QUOTE=Banana Lord.;39614008]Why aren't you just setting RPExtraTeams[TEAM_POLICE]["max"]?[/QUOTE] And more on this- it'll raise the limit serverside but clientside it'll remain whatever the default was. You could always set a net message to current players (and ones that connect later) to set the variable though, if clientside sync is important to you. I don't think DarkRP does anything with the limit off the top of my head, but it may use it for the F4 jobs menu, I can't remember.
[QUOTE=Annoyed Tree;39612276][/QUOTE] Yea this will work as global value "0" but it always will be "0" [QUOTE=Banana Lord.;39614008]Why aren't you just setting RPExtraTeams[TEAM_POLICE]["max"]?[/QUOTE] I don't undestand how to setting this
[QUOTE=lua_error;39619110]Yea this will work as global value "0" but it always will be "0" I don't undestand how to setting this[/QUOTE] it's a variable, set it the same as any other
Someone get Divinity over here, he's got this on his server...he could give some pointers.
Sorry, you need to Log In to post a reply to this thread.