Skrypt zaczerpnięty z innego forum
Jest to mój system pokoju treningowego w wersji 0.1 - zwykła teleportacja do pokoju + system ANTY AFK! system anty AFK polega na tym, ze jezeli w przeciagu danego czasu min. nie klikniemy na dzwignie znajdujaca sie w pokoju - po danym czasie zostajemy wyrzuceni z pokoju. Będę robił częste aktualizacje skryptu! data->actions->trainroom.lua
Spoiler:-- Training Room by ersiu[Azeroth#24] . All rights reserved! -- -- Version 0.1 --- function onUse(cid, item, topos, item2, topos) local back = false local czas = 0 local stopafk = 5 -- po ilu minutach wyrzuca z pokoju - w minutach!
local np = {north=50001, south=50002, west=50003, east=50004} -- actionid pokoi, które teleportują na poszczególne strony. npos = getThingfromPos(getPlayerPosition(cid)) if(item.actionid == np.north and npos.x==topos.x)then if(getPlayerStorageValue(cid, 50000) == 0)then npos = npos.y+2 else npos = npos.y-2 back = true end setPlayerStorageValue(cid, 50000, 1) elseif(item.actionid == np.south and npos.x==topos.x)then if(getPlayerStorageValue(cid, 50000) == 0)then npos = npos.y-2 else npos = npos.y+2 back = true end setPlayerStorageValue(cid, 50000, 2) elseif(item.actionid == np.west and npos.y==topos.y)then if(getPlayerStorageValue(cid, 50000) == 0)then npos = npos.x-2 else npos = npos.x+2 back = true end setPlayerStorageValue(cid, 50000, 3) elseif(item.actionid == np.east and npos.y==topos.y)then if(getPlayerStorageValue(cid, 50000) == 0)then npos = npos.x+2 else npos = npos.x-2 back = true end setPlayerStorageValue(cid, 50000, 4) end if(back==true)then setPlayerStorageValue(cid, 50000, -1) end doTeleportThing(cid, npos) local function antyAFK(i) if(getPlayerStorageValue(cid, 50000)==1)then xpos = i.npos.y-2 elseif(getPlayerStorageValue(cid, 50000)==2)then xpos = i.npos.y+2 elseif(getPlayerStorageValue(cid, 50000)==3)then xpos = i.npos.x+2 elseif(getPlayerStorageValue(cid, 50000)==4)then xpos = i.npos.x-2 end doTeleportThing(i.cid, xpos) end if(czas == 0)then addEvent(antyAFK, (stopafk*60000), {cid=cid, npos=getThingfromPos(getPlayerPosition(cid))}) doPlayerSendTextMessage(cid, 19, 'Zostales wpuszczony do train roomu na '..stopafk..' Minut, aby przedluzyc czas kliknij po uplywie 10 minut na dzwignie!') czas = os.time() end if(item.actionid == 64646)then if(os.time() <= (czas+stopafk*30))then stopEvent(antyAFK) addEvent(antyAFK, (stopafk*60000), {cid=cid, npos=getThingfromPos(getPlayerPosition(cid))}) doPlayerSendTextMessage(cid, 19, 'Czas treningu został przedluzony do '..stopafk..' minut!') czas = os.time() else doPlayerSendTextMessage(cid, 19, 'Odczekaj '..(stopafk/2)..' min po kliknieciu w dzwignie') end end if(item.itemid == 1945)then doTransformItem(item.uid, 1946) elseif(item.itemid == 1946)then doTransformItem(item.uid, 1945) end
end
data->actions->actions.xml
Spoiler:<action actionid="50001" script="trainroom.lua"/> <action actionid="50002" script="trainroom.lua"/> <action actionid="50003" script="trainroom.lua"/> <action actionid="50004" script="trainroom.lua"/> <action actionid="64646" script="trainroom.lua"/>
teraz tak! wejście do góry[north] dajemy itemowi, na który trzeba kliknąć[standard - drzwi] actionid na 50001 na doł [south] - 50002 w lewo [west] - 50003 w prawo [east] - 50004 i na koniec w każdym train roomie musi znajdować się dzwignia posiadająca actionid 64646!
Życzę miłego, bezpiecznego[aby nie paść na trainerach ^^] użytkowania skryptu.
Pozdrawiam,Dimek
|