• Dark RP VIP Code isn't working for FAdmin
    6 replies, posted
Hi my name is John and I'm an alcoholic... So I'm doing all the setup for a Dark RP server and I want to use Fadmin and this code (below) but it doesn't seem to work with Fadmin and I can't find another code to make it work. [CODE]customCheck = function(ply) return table.HasValue({"Owner", "superadmin", "VIP"}, ply:GetNWString("usergroup")) CustomCheckFailMsg = "This is a VIP Job!", end,[/CODE] Here's how I have it in the lua file [CODE]Team_FBI = DarkRP.createJob("FBI", { color = Color(0, 0, 0, 255), model = { "models/fbi_pack/fbi_01.mdl", "models/fbi_pack/fbi_02.mdl", "models/fbi_pack/fbi_03.mdl", "models/fbi_pack/fbi_04.mdl", "models/fbi_pack/fbi_05.mdl", "models/fbi_pack/fbi_06.mdl", "models/fbi_pack/fbi_07.mdl", "models/fbi_pack/fbi_08.mdl", "models/fbi_pack/fbi_09.mdl", }, description = [[Your job is to gather info for the CP,Swat and mayor and report back so as a team figure out a plan of action to take down your target.]], weapons = {"weapon_shield", "weapon_checker", "weapon_stungun", "arrest_stick", "door_ram", "stunstick", "bb_cssfrag_alt", "bb_css_smoke_alt", "unarrest_stick", "m9k_scar", "m9k_honeybadger", "keypad_cracker", "lockpick", "weapon_rad15", "breachingcharge"}, command = "fbi", max = 8, salary = 350, admin = 0, vote = false, hasLicense = false, candemote = true, category = "Government", hasRadio = true, canTalkToGlobal = true, customCheck = function(ply) return table.HasValue({"Owner", "superadmin", "VIP"}, ply:GetNWString("usergroup")) CustomCheckFailMsg = "This is a VIP Job!", end, })[/CODE] EDIT: Here's a picture of the error [URL="http://www.mediafire.com/view/d9zywwaeb1kkyxe/error.png"]http://www.mediafire.com/view/d9zywwaeb1kkyxe/error.png[/URL]
It's not an FAdmin issue. Referring to the Custom Job Fields page: [url]http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields[/url] The customCheck field should look something like this example: [lua]customCheck = function(ply) return ply:getDarkRPVar("money") > 10000 end,[/lua] More specifically, you need an 'end' to your function. To make this more obvious, you should keep your function for customCheck all on one line if possible (your code is short enough that it is possible). Function syntax reference: [url]http://www.lua.org/pil/5.html[/url]
I'm sorry I just don't understand...everything you shown me went over my head! Can I get the vip code that will work with Fadmin?
You wrote: [lua] customCheck = function(ply) return table.HasValue({"Owner", "superadmin", "VIP"}, ply:GetNWString("usergroup")) CustomCheckFailMsg = "This is a VIP Job!", end,[/lua] This 'end' should be at the end of the function ("function(ply) return table.HasValue({"Owner", "superadmin", "VIP"}, ply:GetNWString("usergroup"))") Functions are written as "function() return ~blah blah code~ end", notice the end is after the code here. The end should be at the end of your function, and CustomCheckFailMsg should not be in the middle of that. It's part of the job, not part of that function. Like, you want something that resembles this: [lua] customCheck = function(ply) return ~VIP check stuff~ end, CustomCheckFailMsg = "This is a VIP Job!", [/lua]
I tried to use that code but it didn't work! I did find this code (shown below ) it works...... [CODE]customCheck = function(ply) return ply:GetNWString("usergroup") == "Owner", "superadmin", "donator" end,[/CODE] but when I try to add this line under the code (shown below) it stops working! [CODE]CustomCheckFailMsg = "This is a VIP Job!",[/CODE] Can somebody tell me how to make it were I can add that custom check message code?
I wasn't giving you code to use, I was trying to tell you to just cut and paste the 'end' word to where you have it in your new code. I didn't know you could test for equality with a list, if that really works it must be a gmod lua thing. There's no reason for the fail msg to cause it to stop if it's working otherwise, are you getting the same error?
I don't know why either. You need to understand I don't understand your post I tried to understand it but I couldn't but thanks for trying to help me! Here's the picture of the error [URL="http://www.mediafire.com/view/1cbd7jkx566x460/error2.png"]http://www.mediafire.com/view/1cbd7jkx566x460/error2.png[/URL] and here's how I have it in the lua file [CODE]Team_FBI = DarkRP.createJob("FBI", { color = Color(0, 0, 0, 255), model = { "models/fbi_pack/fbi_01.mdl", "models/fbi_pack/fbi_02.mdl", "models/fbi_pack/fbi_03.mdl", "models/fbi_pack/fbi_04.mdl", "models/fbi_pack/fbi_05.mdl", "models/fbi_pack/fbi_06.mdl", "models/fbi_pack/fbi_07.mdl", "models/fbi_pack/fbi_08.mdl", "models/fbi_pack/fbi_09.mdl", }, description = [[Your job is to gather info for the CP,Swat and mayor and report back so as a team figure out a plan of action to take down your target.]], weapons = {"weapon_shield", "weapon_checker", "weapon_stungun", "arrest_stick", "door_ram", "stunstick", "bb_cssfrag_alt", "bb_css_smoke_alt", "unarrest_stick", "m9k_scar", "m9k_honeybadger", "keypad_cracker", "lockpick", "weapon_rad15", "breachingcharge"}, command = "fbi", max = 8, salary = 350, admin = 0, vote = false, hasLicense = false, candemote = true, category = "Government", hasRadio = true, canTalkToGlobal = true, customCheck = function(ply) return ply:GetNWString("usergroup") == "Owner", "superadmin", "moderator", "VIP" end CustomCheckFailMsg = "This is a VIP Job!", })[/CODE]
Sorry, you need to Log In to post a reply to this thread.