adrianoswatt

PrivateWar Sys Actions

May 17th, 2017
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. -- ########################################################
  2. -- #####          Name: Adriano Swatt'                #####
  3. -- #####              Version: 1.0                    #####
  4. -- ########################################################
  5. -- #####        Developed by Adriano Swatt'           #####
  6. -- #####     Contact: [email protected]        #####
  7. -- #####       PRIVATE WAR SYSTEM BY SWATT'           #####
  8. -- ########################################################
  9. local cfg = _PRIVATE_WAR_SYSTEM_CONFIG
  10. function onUse(cid, item, frompos, item2, topos)
  11.     if getGlobalStorageValue(cfg.gbet_sto) > 0 then
  12.         local string = tostring(getGlobalStorageValue(cfg.glead_sto))
  13.         local cutSto = string:explode(";")
  14.         doPlayerSendTextMessage(cid, 18, "O evento já está em progresso. \n[Blue Team Leader: "..cutSto[1].." ("..getGlobalStorageValue(cfg.teamConfig[1].gsto_kills).." Points) Vs. Red Team Leader: "..cutSto[2].." ("..getGlobalStorageValue(cfg.teamConfig[2].gsto_kills).." Points)].")
  15.         return true
  16.     end
  17.     bet = checkPrivWarBet(cid)
  18.     if bet then -- Checa Apostas
  19.         teamID = getPrivWarTeam(cid)
  20.         if item.itemid ~= cfg.teamConfig[teamID].lever.on then -- Checa Alavanca NÃO Puxada
  21.             if checkPrivWarTeams(cid) then -- Checa Numero de Players nos Times
  22.                 if getAlreadyLeverPrivWar(cid, teamID) then -- Checa 1ª Alavanca Puxada
  23.                     doPrivWarStart(cid, bet, teamID)
  24.                     doTransformItem(item.uid, cfg.teamConfig[teamID].lever.on)
  25.                 else
  26.                     doChanceLeverPrivWar(cid, item.uid, teamID)
  27.                 end
  28.             else
  29.                 doPlayerSendCancel(cid, "Cada time precisa ter o mesmo tanto de participantes e mais de "..cfg.minPlayers.." em cada.")
  30.             end
  31.         else
  32.             doPlayerSendCancel(cid, "Esta alavanca já foi puxada, aguarde o oponente puxar a dele.")
  33.         end
  34.     else
  35.         doPlayerSendCancel(cid, "O valor da aposta precisa ser igual e maior do que 0 crystal coin.")
  36.     end
  37. return true
  38. end
Advertisement
Add Comment
Please, Sign In to add comment