• Need help with a police autopromotion (french)
    2 replies, posted
So, I said to a guy, I can do it for free, I think he knows why now! What I want to do: I want it to do one thing, use Utime and AutoPromote, but how? I tried using [code] if group == "group1" then promotes == { { hours = 0, group = "recrue", name = "Recrue de polic" }, { hours = 4, group = "officier", name = "Officier de Police" }, { hours = 12, group = "inspecteur", name = "Inspecteur de police" }, { hours = 20, group = "capitaine", name = "Capitaine de Police" }, { hours = 48, group = "commissaire", name = "Commissaire de Police" }, } end [/code] and [code] if group == "recrue" and hours == 4 then group = "officier" elseif group == "officier" and hours == 12 then group = "inspecteur" elseif group == "inspecteur" and hours == 20 then group = "capitaine" elseif group == "capitaine" and hours == 48 then group = "commissaire" end [/code] But did it work? No... sadly not. Any help? Addons used: AutoPromote, UTime, ULX and Ulib, with gamemode darkrp. If you have any idea... please comment down bellow! Please no hate, only love :D
Is this all the code you have? Did you only create if statements?
[QUOTE=boxvader;50452223]Is this all the code you have? Did you only create if statements?[/QUOTE] well yeah, I mostly used the autopromote code, want it: [code] if not SERVER then return end --AutoPromote 2.0 --Automaticly promotes players to different groups based on UTime. --[[ CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO: HOLOGRAPHICpizza Major_Pain Smithy PRETTY SELF EXLANATORY HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED ]] promotes = { { hours = 0, group = "recrue", name = "Recrue de polic" }, { hours = 4, group = "officier", name = "Officier de Police" }, { hours = 12, group = "inspecteur", name = "Inspecteur de police" }, { hours = 20, group = "capitaine", name = "Capitaine de Police" }, { hours = 48, group = "commissaire", name = "Commissaire de Police" }, } ---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER excludes = { "donator", "moderator", "admin", "superadmin" } ---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements settings = { { msgOn = true, msgcol = Color(255,225,0), effOn = true } } --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- --------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING--------------- --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- if settings[1].effOn then resource.AddFile( "sound/autopromote/promote.wav" ) end local cID = 1 function checkExcludes( ply ) for id, eX in pairs (excludes) do if not ply:IsUserGroup(excludes[id]) then exclude = false else exclude = true end end return exclude end function groupSet( ply ) local plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60) while plhrs >= promotes[cID].hours and cID < table.Count(promotes) do cID = cID + 1 groupTS = promotes[cID-1].group end if cID == table.Count(promotes) then groupTS = promotes[table.Count(promotes)].group return true else if cID <= 2 then if plhrs >= promotes[1].hours then return true end else if plhrs >= promotes[cID-1].hours then return true end end end return false end function promotePlayer( ply ) if not checkExcludes( ply ) then cID = 1 if groupSet( ply ) and not ply:IsUserGroup(groupTS) then if settings[1].msgOn then for ud, blank in pairs( player.GetAll()) do if cID == table.Count(promotes) then cID = table.Count(promotes) + 1 return true else ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..promotes[cID-1].name.."'.") end end cID = 1 if settings[1].effOn then effectS( ply ) WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 ) end ulx.adduser(nil, ply, groupTS) --game.ConsoleCommand("ulx adduser "..string.format("%q", ply:Nick() ).." "..groupTS.."\n") end end if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply) end end end function effectS( ply ) local ed = EffectData() ed:SetEntity(ply) util.Effect("autopromotion",ed, true, true) local vPoint = ply:GetPos() local effectdata = EffectData() local r = math.random(20, 255) local g = math.random(20, 255) local b = math.random(20, 255) effectdata:SetStart( Vector( r, g, b ) ) effectdata:SetOrigin( vPoint ) effectdata:SetScale( 1 ) util.Effect( "autopromotion2", effectdata ) timer.Simple( 1, function() r = math.random(20, 255) g = math.random(20, 255) b = math.random(20, 255) effectdata:SetStart( Vector( r, g, b ) ) local vPoint = ply:GetPos() effectdata:SetOrigin( vPoint ) util.Effect( "autopromotion2", effectdata ) end) timer.Simple( 2, function() r = math.random(20, 255) g = math.random(20, 255) b = math.random(20, 255) effectdata:SetStart( Vector( r, g, b ) ) local vPoint = ply:GetPos() effectdata:SetOrigin( vPoint ) util.Effect( "autopromotion2", effectdata ) end) timer.Simple( 3, function() r = math.random(20, 255) g = math.random(20, 255) b = math.random(20, 255) effectdata:SetStart( Vector( r, g, b ) ) local vPoint = ply:GetPos() effectdata:SetOrigin( vPoint ) util.Effect( "autopromotion2", effectdata ) end) timer.Simple( 4, function() r = math.random(20, 255) g = math.random(20, 255) b = math.random(20, 255) effectdata:SetStart( Vector( r, g, b ) ) local vPoint = ply:GetPos() effectdata:SetOrigin( vPoint ) util.Effect( "autopromotion2", effectdata ) end) end function timerStart( ply ) timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply) end hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart) function destroyTimers(ply) if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then timer.Stop("Promotion-" ..tostring(ply:SteamID())) timer.Destroy("Promotion-" ..tostring(ply:SteamID())) end end hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers ) [/code]
Sorry, you need to Log In to post a reply to this thread.