18.01.2017, 18:38
Command:
Timer:
Why is the time raising instead of going down? From 40 it got to 370, I want it to go down from 50 seconds to zero...
Код:
CMD:reqmed(playerid, params[]) { new string[64], option[4], item[5], amount[5]; sscanf(params, "sss", option, item, amount); if(isnull(option)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /reqmed <optiune>"); SendClientMessage(playerid, COLOR_GREY, "OPTIUNI: brokenleg"); return 1; } if (!strcmp(option, "brokenleg")) { if(pLegBroken[playerid] == true) { SetPlayerPos(playerid, 1506.3864,-1530.9393,1971.8003); TogglePlayerControllable(playerid, 0); LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); SendClientMessage(playerid, COLOR_GREEN, "Ai fost trimis in sala de operatie, te rugam sa astepti."); CountDownTimer = SetTimerEx("CountDown", 1000, false, "i", playerid); } else { SendClientMessage(playerid, COLOR_GREY, "Nu ai picioarele ranite."); } } return 1; }
Код:
forward CountDown(playerid); public CountDown(playerid) { CountDownVar--; new str[128]; if(CountDownVar == 0) { KillTimer(CountDownTimer); CountDownVar = 4; if(pLegBroken[playerid] == true) { pLegBroken[playerid] = false; SendClientMessage(playerid, 0x33AA33AA, "> Ai fost eliberat din spital, piciorul tau este mai bine."); SetPlayerPos(playerid, 1502.5439,-1546.3174,1970.7870); TogglePlayerControllable(playerid, 1); } } else { format(str, sizeof(str), "Timp ramas in operatie: %d", CountDownTimer); GameTextForPlayer(playerid, str, 1000, 1); } return 1; }