• Donator Jobs visible for users
    5 replies, posted
So I tried making my donator jobs visible for normal users by putting this code: [CODE]if t == TEAM_SWAT or t == TEAM_SWATSNIPER or t == TEAM_HITMAN and not self:IsUserGroup("donator") or self:IsUserGroup("superadmin") or self:IsUserGroup("rootadmin") or self:IsUserGroup("owner") then GAMEMODE:Notify(self, 1, 4, string.format("Message for non-donators.") return end[/CODE] In the player.lua at function meta:ChangeTeam(t, force) (line 208) It looked like this: [CODE]function meta:ChangeTeam(t, force) if self:isArrested() and not force then GAMEMODE:Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), "")) return false end if t == TEAM_SWAT or t == TEAM_SWATSNIPER or t == TEAM_SWATMEDIC or t == TEAM_HITMAN or t == TEAM_SA or t == TEAM_PROTHIEF and not self:IsUserGroup("donator") or self:IsUserGroup("donatoradmin") or self:IsUserGroup("donatortrusted") or self:IsUserGroup("superadmin") or self:IsUserGroup("rootadmin") or self:IsUserGroup("owner") then GAMEMODE:Notify(self, 1, 4, string.format("This is a donator job! Buy donator to unlock!") return end[/CODE] I left the isarrested in cause it was int he code In my shared.lua i removed these codes at end of the donator jobs: [CODE] customCheck = function(ply) return ply:GetUserGroup() == "admin" or ply:GetUserGroup() == "donatorsuperadmin" or ply:GetUserGroup() == "superadmin" or ply:GetUserGroup() == "donatorsuperadmin" or ply:GetUserGroup() == "rootadmin" or ply:GetUserGroup() == "owner" end[/CODE] Now when i join game you get unassigned job and this is the error: [CODE][ERROR] gamemodes/darkrp/gamemode/server/gamemode_functions.lua:497: attempt to call method 'NewData' (a nil value) 1. unknown - gamemodes/darkrp/gamemode/server/gamemode_functions.lua:497 [ERROR] gamemodes/darkrp/gamemode/server/gamemode_functions.lua:497: attempt to call method 'NewData' (a nil value) 1. unknown - gamemodes/darkrp/gamemode/server/gamemode_functions.lua:497 L 02/23/2013 - 16:56:51: Lua Error: [ERROR] gamemodes/darkrp/gamemode/server/gamemode_functions.lua:593: attempt to call method 'isArrested' (a nil value) 1. unknown - gamemodes/darkrp/gamemode/server/gamemode_functions.lua:593 [ERROR] gamemodes/darkrp/gamemode/server/gamemode_functions.lua:593: attempt to call method 'isArrested' (a nil value) 1. unknown - gamemodes/darkrp/gamemode/server/gamemode_functions.lua:593 L 02/23/2013 - 16:56:51: Lua Error: [ERROR] gamemodes/darkrp/gamemode/server/gamemode_functions.lua:706: attempt to call method 'isArrested' (a nil value) 1. Call - gamemodes/darkrp/gamemode/server/gamemode_functions.lua:706 2. PlayerSpawn - gamemodes/base/gamemode/player.lua:248 3. PlayerSpawn - gamemodes/sandbox/gamemode/init.lua:41 4. unknown - gamemodes/darkrp/gamemode/server/gamemode_functions.lua:613[/CODE] Anyone knows how to do it so my users can still see the jobs?
If the teams are unassigned, it means you probably missed a bracket somewhere. Link some more errors? Preferably the ones that start when the gamemode is loaded.
I'm not exactly a great Lua Coder but try [URL="http://pastebin.com/R9CdfUjH"]this[/URL].
[lua] tags...
[QUOTE=Keydose;39689446]I'm not exactly a great Lua Coder but try [URL="http://pastebin.com/R9CdfUjH"]this[/URL].[/QUOTE] It didnt work, I can't become any job :/ I use ULX? are these the right GetUserGroup commands? tnx!
Seriously? ._. There are a ')' Missing at the end of GAMEMODE:Notify ..... This is how it would look like: [code] GAMEMODE:Notify(self, 1, 4, string.format("Message for non-donators.")) [/code] Notice the Second bracket at the end, look at the errors before posting. And TRY solve them yourself.
Sorry, you need to Log In to post a reply to this thread.