nlmarkoesnl Posted August 21, 2013 Share Posted August 21, 2013 Hey all I got a afk script, but after it shows in the chat that the player is been warned for [3/3] He needs to be kicked out the server. but my script won't let that happen, in the server its sais: " acces denied @ "kickplayer" But i don't see a mistake. Hope that 1 of you guys can help me out what the problem is? Scripts: Main_server ---------------------------------------------- -- AFK killer - extended from clienside script ---------------------------------------------- local raceState = "" local enableMessages = true local messageColor = "#98F5FF" function afkMsg(mtype,afkCount) if(mtype == 1) then outputChatBox("#0000ff* #FFFFFF".. getPlayerName(source).. "#0000ff has been killed by the #FFFFFFAFK killer#0000ff #0000ff[#98F5FF"..afkCount.."/3#0000ff]",getRootElement(),255,255,255,true) elseif(mtype == 2) then outputChatBox("#0000ff* #FFFFFF".. getPlayerName(source).. "#0000ff has been kicked for staying #FFFFFFAFK#0000ff for 3 rounds!",getRootElement(),255,255,255,true) end end addEvent( "afkWarn", true ) addEventHandler( "afkWarn", getRootElement(), afkMsg) function afkKill() local thePlayer = source callClientFunction(thePlayer,"setKBA",thePlayer) setElementHealth(source, 0) end addEvent( "afkSlap", true ) addEventHandler( "afkSlap", getRootElement(), afkKill) function changeRaceState(newStateName) raceState = newStateName end addEvent("onRaceStateChanging", true) addEventHandler( "onRaceStateChanging", getRootElement(), changeRaceState) function afkKick(player) kickPlayer(player,"AFK") end Main_client ------------- -- AFK killer ------------- local MaxAFKtime = 30 local warnTime = 20 local v = 0 local AFKtime = 0 local sx,sy = guiGetScreenSize() local wEvent = false function rWarn() dxDrawImage( sx/2 - 300, sy/2 - 100, 600, 200, "img/warn.png") dxDrawText("You will be killed in "..tostring(tCount).." seconds",sx/2 - 255, sy/2 + 45,sx,sy,tocolor(0,222,222,222),1.01,"bankgothic") end function stopWarn() if(wEvent) then removeEventHandler("onClientRender", getRootElement(), rWarn) wEvent = false end end function imgHandler() stopWarn() end addEventHandler("onClientPlayerWasted",getLocalPlayer(),imgHandler) function checkMain() if isPedInVehicle ( getLocalPlayer() ) then aTimeAdd() end end function aTimeAdd() AFKtime = AFKtime + 1 local isFinished = getElementData ( getLocalPlayer(), "dead") if(isElementFrozen ( getPedOccupiedVehicle ( getLocalPlayer() )) and isFinished == false) then aTimeClear() end local isNew = getElementData (getLocalPlayer(), "state") if isNew == "waiting" or isNew == "dead" then aTimeClear() end if(getPedOccupiedVehicle ( getLocalPlayer() ) ~= false) then local player = getLocalPlayer() if(AFKtime >= MaxAFKtime) then if (afkCounter <= 2) then triggerServerEvent ( "afkWarn", player, 1, afkCounter) afkCounter = afkCounter+1 triggerServerEvent ( "afkSlap", player) stopWarn() elseif (afkCounter > 2) then triggerServerEvent ( "afkWarn", player, 1, afkCounter) triggerServerEvent ( "afkWarn", player, 2) afkCounter = 1 triggerServerEvent ( "afkKick", player, 3,player) end elseif(AFKtime >= warnTime) then tCount = tCount - 1 if(not wEvent) then addEventHandler("onClientRender", getRootElement(), rWarn) wEvent = true end end end end setTimer ( checkMain, 1000, -1) function aTimeClear() AFKtime = 0 tCount = 11 stopWarn() end bindKey("accelerate","down",aTimeClear) bindKey("vehicle_left","down",aTimeClear) bindKey("vehicle_right","down",aTimeClear) bindKey("brake_reverse","down",aTimeClear) function onClientLoaded(res) triggerServerEvent("onClientLoaded",getLocalPlayer()) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),onClientLoaded) function loadSettings(maxtime, wtime ) MaxAFKtime = tonumber(maxtime) warnTime = tonumber(wtime) end addEvent( "onSettingsReady", true ) addEventHandler( "onSettingsReady", getRootElement(), loadSettings ) function setKBA(thePlayer) killedByAfk = 1 end function getKBA(thePlayer) if killedByAfk == 0 then thePlayer = getLocalPlayer() callServerFunction("earnMoney", thePlayer) end end function deathReset() if killedByAfk == 0 then afkCounter = 1 else end end addEventHandler("onClientPlayerWasted",getLocalPlayer(),deathReset) function resetKBA() killedByAfk = 0 end Link to comment
RainBow Posted August 22, 2013 Share Posted August 22, 2013 Can we see the config? It seems the personal who is triggering it does not have ACL access. Link to comment
nlmarkoesnl Posted August 22, 2013 Author Share Posted August 22, 2013 Can we see the config? It seems the personal who is triggering it does not have ACL access. You mean the meta file? Or the whole file of the script of main server and main client? Link to comment
Markeloff Posted August 23, 2013 Share Posted August 23, 2013 add resource name to Admin ACL Group to have access of kicking. add object resource.resourcename . Link to comment
nlmarkoesnl Posted August 23, 2013 Author Share Posted August 23, 2013 add resource name to Admin ACL Group to have access of kicking. add object resource.resourcename . first thanks for trying me to help with this! i did what you said. But it's still not working.. still get the same message in the console : ( main_server.lua"2537: bad argument @ "kickPlayer: ) Dont know what's wrong with that line! any other idea's maby change the line? Link to comment
nlmarkoesnl Posted August 23, 2013 Author Share Posted August 23, 2013 post line 2537 This is the line : kickPlayer(player,"AFK") Link to comment
nlmarkoesnl Posted August 23, 2013 Author Share Posted August 23, 2013 Post the whole script. You can find the script @ the top of the page. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now