Countdown problem
#6

Код:
  format(str, sizeof(str), "%d", WCDTimer);
You're showing WCDTimer for the cooldown instead of WCDVar. This is most likely your problem but there are more than one errors in your code. For example:

You're using GameTextForAll but in the command you check for specific players. Your codes redundant and half of it is irrelevant.

Make WCDTimer a player variable.
PHP код:
new WCDTimer[MAX_PLAYERS]; 
Instead of SetTimer, we'll use SetTimerEx to define the players.
PHP код:
CMD:wcd(playeridparams[])
{
      if (!
PlayerInfo[playerid][W])
         return 
SendClientMessage(playerid, -1"You don't have permission to use this.");
      for (new 
0MAX_PLAYERSi++){
          if (
PlayerInfo[i][W]){
               
WCDTimer[i] = SetTimerEx("WCD"1000,  true"i"i);
          }
      }
      
CMDMessageToW(playerid"WCountDown");
      return 
1;

Change your public function:
PHP код:
public WCD(playerid)
{
     
WCDVar--; 
     new 
str[60]; 
     if(
WCDVar == 0)
     {
          
KillTimer(WCDTimer[playerid]);
          
WCDVar 4;
     }
     else
     {
         
format (strsizeof(str), "%d"WCDVar);
         
GameTextForPlayer(playeridstr30006);
     }
     return 
1;

Reply


Messages In This Thread
Countdown problem - by Kyriee - 03.08.2017, 12:41
Re: Countdown problem - by Arbico - 03.08.2017, 12:46
Re: Countdown problem - by Kyriee - 04.08.2017, 07:33
Re: Countdown problem - by Kyriee - 05.08.2017, 07:58
Re: Countdown problem - by Kyriee - 07.08.2017, 09:19
Re: Countdown problem - by Kane - 07.08.2017, 09:34
Re: Countdown problem - by Kyriee - 17.08.2017, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)