Zoeken
Resultaten weergeven voor de tags 'scripts script afk help mta'.
1 resultaat gevonden
-
Hallo allemaal! ten eerste wil ik zeggen, Mooi forum! Nu de 2e wat ik wil zeggen/vragen, het gene waarvoor ik ben gekomen: Ik heb een AFK script! Alles doet het prima! hij laat de image zien als degene afk is, en als ie dan gekild work, dat het ook in de chat is te zien ! bijv: henkie has been killed by the afk warning [1/3] <| En bij [3/3] zou de player gekickt moeten worden, Maar dat gebeurt dus niet! in de server geeft hij aan > acces denied @ "kickplayer" < Ik heb er naar gekeken, maar ik krijg het niet voor elkaar omhet te fixen. Zou iemand misschien even kunnen kijken wat er fout zit? alvast bedankt! Scripts: Main_server.lua: ---------------------------------------------- -- 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.lua: ------------- -- 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 >>> Door .Timothy: Verplaatst naar Multi Theft Auto.<<<