• attempt to perform arithmetic on a string value
    5 replies, posted
Hey, can someone help me? I've been messing around with a DarkRP job, which was throwing errors and when I finally got it fixed, this error appears and I can't join my server. [CODE] [ERROR] gamemodes/darkrp/gamemode/modules/fadmin/sh_fadmin_darkrp.lua:111: attempt to perform arithmetic on a string value 1. fn - gamemodes/darkrp/gamemode/modules/fadmin/sh_fadmin_darkrp.lua:111 2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 [/CODE] Job; [CODE]TEAM_MAYOR = AddExtraTeam("Mayor", { color = Color(150, 20, 20, 255), model = "models/player/breen.mdl", description = [[The Mayor of the city creates laws to serve the greater good of the people. If you are the mayor you may create and accept warrants. Type /wanted <name> to warrant a player Type /jailpos to set the Jail Position Type /lockdown initiate a lockdown of the city. Everyone must be inside during a lockdown. The cops patrol the area /unlockdown to end a lockdown]], weapons = {"weapon_fists"}, command = "mayor", max = 1, salary = 100, admin = 0, vote = true, hasLicense = false, mayor = true, help = { "Type /warrant [Nick/SteamID/Status ID] to set a search warrant for a player.", "Type /wanted [Nick/SteamID/Status ID] to alert everyone to a wanted suspect.", "Type /unwanted [Nick/SteamID/Status ID] to clear the suspect.", "Type /lockdown to initiate a lockdown", "Type /unlockdown to end a lockdown", "Type /placelaws to place a screen containing the laws.", "Type /addlaw and /removelaw to edit the laws." }, MayorDeath = function( ply, inflictor, attacker ) if ply:Team() == TEAM_MAYOR then ply:SetTeam(TEAM_CITIZEN) for k,v in pairs( player.GetAll() ) do v:PrintMessage( HUD_PRINTCENTER, "The mayor has been killed!" ); if attacker:Team() == TEAM_RLeader then attacker:SetTeam(TEAM_RMayor) for k,v in pairs( player.GetAll() ) do v:PrintMessage( HUD_PRINTCENTER, "The Rebels have replaced the Mayor!" ); hook.Add( "GM:PlayerDeath", "MayorDeathCheck", MayorDeath) end end end end end })[/CODE]
post the code
Added the code to OP Anyone? Please help, I can't join the server as it is now.
[lua] local function MayorDemote( ply, inflictor, attacker ) if ply:isMayor() then ply:SetTeam(TEAM_CITIZEN) if attacker:Team() == TEAM_RLeader then attacker:SetTeam(TEAM_MAYOR) for k,v in pairs(player.GetAll()) do v:PrintMessage( HUD_PRINTCENTER, "The Rebels have replaced the Mayor!" ) end end end end hook.Add("PlayerDeath", "MayorDemotion", MayorDemote) [/lua] I'm not sure if you can place that next to a job. What I would normally do is edit the PlayerDeath hook and add that in, excluding the function and adding the hook.
It must be the job, as i've not really edited any files other than the ones in the DarkRP Modification folder. I placed the code next to the job, as thats where I had the original (working) reset mayor on death code, but then when I edited it to do this, it's broke. But thank you for the replies! // I removed the code from the lua file without change, I've also tried disabling both ULX, ULib and FAdmin, with no success.
Sorry, you need to Log In to post a reply to this thread.