Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('<j>Lancement de la fonction afk.')
- function afk(option1,option2,option3,option4)
- -- Préparation pour un joueur.
- if option1 == 'set' then
- isAfk[option2] = false
- idnumber = idnumber + 1
- id[option2] = idnumber
- afkRaison[option2] = ""
- afkTime[option2] = 0
- for i = 0, 200 do
- tfm.exec.bindKeyboard(option2, i, true, true) -- Active les touches.
- end
- -- Lancement de la fonction afk.
- elseif option1 == 'start' then
- print('<j>Le fonction afk marche !')
- isAfk = {}
- afkTime = {}
- afkRaison = {}
- id = {}
- idnumber = 50000
- for joueur,player in pairs(tfm.get.room.playerList) do
- afk('set',joueur)
- end
- -- Le joueur est afk.
- elseif option1 == 'afk' then
- ui.addTextArea(id[option2],"<a href='event:|AFK|"..option2.." est afk pour la raison : "..afkRaison[option2].."'>AFK</a>",all,tfm.get.room.playerList[option2].x-13,tfm.get.room.playerList[option2].y-40,28,18)
- tfm.exec.setPlayerScore(option2,-2000)
- -- Le joueur n'est plus afk.
- elseif option1 == 'noafk' then
- ui.removeTextArea(id[option2], all)
- isAfk[option2] = false
- tfm.exec.setPlayerScore(option2,0)
- afkTime[option2] = 0
- elseif option1 == 'afktime' then
- for joueur,player in pairs(tfm.get.room.playerList) do
- afkTime[joueur] = afkTime[joueur] + 0.5
- if isAfk[joueur] then
- afkRaison[joueur] = 'Auto AFK'
- else
- if afkTime[joueur] == 60 then afk('afk',joueur) end
- end
- end
- -- eventTextAreaCallback
- elseif option1 == 'callback' then
- if option3:sub(0,5) == "|AFK|" then
- ui.addTextArea(10000, "<p align='center'><j><a href='event:closepopup'>Pour fermer , clique ici !</a><br>"..option3.."</p>", option2, 10, 30, 770,50)
- elseif option3 == "closepopup" then
- ui.removeTextArea(10000, option2)
- end
- -- Quand le joueur tape la commande !afk.
- elseif option1 == 'command' then
- if isAfk[option2] then
- afk('noafk',option2)
- else
- isAfk[option2] = true
- afkRaison[option2] = option3
- afk('afk',option2)
- end
- end
- end
- function eventNewPlayer(playerName)
- afk('set',playerName)
- end
- function eventPlayerLeft(playerName)
- afk('noafk',playerName)
- end
- function eventKeyboard(playerName, keyCode)
- afk('noafk',playerName)
- end
- function eventChatCommand(playerName,command)
- if command:sub(0,3)=="afk" then afk('command',playerName,command) end
- end
- function eventTextAreaCallback(id,playerName,event)
- afk('callback',playerName,event)
- end
- function eventLoop(currentTime, timeRemaining)
- afk('afktime')
- end
- afk('start')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement