Cooldown.

Mate Započeo Plen Ki Mun
pre 7 godina
431
pregleda
3
postova
Ova tema je zaključana. Samo moderatori i administratori mogu odgovarati.
Mate
Underboss
pre 7 godina
Problem(error/warning): Neće da compile skripta nakon sto dodam cooldown, pise 'stopped working'
Dio skripte:
new GiftCooldown;
new currenttime = gettime();

CMD:nagrada(playerid)
{
    new string;
   
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1277.3118, -1337.5157, 13.4920))
{
    if(currenttime < (GiftCooldown + 60))
        return SendClientMessage(playerid,-1,string);

    format(string,sizeof(string),"Command cooldown %i seconds",((GiftCooldown + 60) - currenttime));
   
Random = random(2);
  switch(Random)
    {
    case 0:
          {
        GivePlayerMoney(playerid, 30000);
          }
          case 1:
          {
          SetPlayerScore(playerid, GetPlayerScore(playerid)+15);;
          }
    }
}
else return SendClientMessage(playerid, -1, "Nisu blizu bora");
GiftCooldown = gettime();
return 1;
}


Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]vaš odgovor[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): link slike
ColicAG
Wheel Man
pre 7 godina
GodoS wrote on December 20, 2018, 4:16 pm:
Problem(error/warning): Neće da compile skripta nakon sto dodam cooldown, pise 'stopped working'
Dio skripte:
new GiftCooldown;
new currenttime = gettime();

CMD:nagrada(playerid)
{
    new string;
   
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1277.3118, -1337.5157, 13.4920))
{
    if(currenttime < (GiftCooldown + 60))
        return SendClientMessage(playerid,-1,string);

    format(string,sizeof(string),"Command cooldown %i seconds",((GiftCooldown + 60) - currenttime));
   
Random = random(2);
  switch(Random)
    {
    case 0:
          {
        GivePlayerMoney(playerid, 30000);
          }
          case 1:
          {
          SetPlayerScore(playerid, GetPlayerScore(playerid)+15);;
          }
    }
}
else return SendClientMessage(playerid, -1, "Nisu blizu bora");
GiftCooldown = gettime();
return 1;
}


Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]vaš odgovor[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): link slike


Gde ti je u CMD:nagrada(playerid, params[])?
Macas
Enforcer
pre 7 godina

new GiftCooldown; // na vrhu skripte
CMD:nagrada(playerid, params[])
{
    new string;
    new currenttime = gettime();
    new Random = random(2);
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 1277.3118, -1337.5157, 13.4920))
    {
        format(string,sizeof(string),"Command cooldown %d seconds", GiftCooldown);
        if(currenttime < GiftCooldown) return SendClientMessage(playerid,-1,string);
        {
            GiftCooldown = currenttime + 60;
            switch(Random)
            {
                case 0:
                {
                    GivePlayerMoney(playerid, 30000);
                }
                case 1:
                {
                    SetPlayerScore(playerid, GetPlayerScore(playerid)+15);;
                }
            }
        }
    }
    else return SendClientMessage(playerid, -1, "Nisu blizu bora");
    return 1;
}

ili ovako
ne  treba da pravis var GiftCooldown;

CMD:nagrada(playerid, params[])
{
    new string;
    new Random = random(2);
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 1277.3118, -1337.5157, 13.4920))
    {
        format(string,sizeof(string),"Command cooldown %d seconds", GetPVarInt(playerid, "GiftCooldown"));
        if(gettime() < GetPVarInt(playerid, "GiftCooldown")) return SendClientMessage(playerid,-1,string);
        {
            SetPVarInt(playerid, "GiftCooldown", gettime()+60);
            switch(Random)
            {
                case 0:
                {
                    GivePlayerMoney(playerid, 30000);
                }
                case 1:
                {
                    SetPlayerScore(playerid, GetPlayerScore(playerid)+15);;
                }
            }
        }
    }
    else return SendClientMessage(playerid, -1, "Nisu blizu bora");
    return 1;
}

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava