public CountDown() { countvar--; new str[128]; if(countvar == 0) { KillTimer(CountDownTimer); countvar = 4; } else { format(str, sizeof(str), "%d", CountDownTimer); GameTextForAll(str, 1000, 1); } } |
C:\Users\Nerijus\Desktop\NevLocus\gamemodes\garza. pwn(2159) : error 022: must be lvalue (non-constant) C:\Users\Nerijus\Desktop\NevLocus\gamemodes\garza. pwn(2159) : warning 215: expression has no effect C:\Users\Nerijus\Desktop\NevLocus\gamemodes\garza. pwn(2161) : error 033: array must be indexed (variable "countvar") C:\Users\Nerijus\Desktop\NevLocus\gamemodes\garza. pwn(2164) : error 033: array must be indexed (variable "countvar") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Errors. |
new countvar[4];
new countvar;
pawn Code:
pawn Code:
|
new countvar=4;//Top on script
forward CountDOwn();
public CountDown()
{
if(countvar != 0)
{
countvar--;
new str[128];
if(countvar == 0)
{
KillTimer(CountDownTimer);
countvar = 4;
}
else
{
format(str, sizeof(str), "%d", CountDownTimer);
GameTextForAll(str, 1000, 1);
}
}
}
format(str, sizeof(str), "%d", CountDownTimer);
#include <a_samp>
new countvar = 10;
new CountDownTimer;
public OnFilterScriptInit()
{
CountDownTimer = SetTimer("CountDown", 1000, true);
return 1;
}
forward CountDown();
public CountDown()
{
countvar--;
new str[6];
if(countvar == 0)
{
KillTimer(CountDownTimer);
countvar = 4;
}
else
{
format(str, sizeof(str), "%d", countvar);
GameTextForAll(str, 1000, 1);
// uncoment this if you want to test it without getting in game -- printf("%d", countvar);
}
}
Like nobody noticed he's formatting the timer's variable? Come on.
pawn Code:
And you don't need 128 cells for just a decimal number, I've changed it to 6, I don't expect from someone to call a countdown for an hour or more, but feel free to increase it if you want. Final code: pawn Code:
|
CountDownTimer = SetTimer("CountDown", 1000, true);
public CountDown() { if(countvar !=0) { countvar--; new str[6]; if(countvar == 0) { KillTimer(CountDownTimer); countvar = 4; } else { format(str, sizeof(str), "%d", countvar); GameTextForAll(str, 1000, 1); } } } CMD ![]() { if(sInfo[playerid][adminlevel] > 4) { CountDownTimer = SetTimer("CountDown", 1000, true); SetPlayerRaceCheckpoint(playerid, 1, -77.6183, 2501.9719, 15.4608, 0.0, 0.0, 0.0, 50.0); return 1; } else { SendClientMessage(playerid, RAUDONA, "Komanda neegzistuoja arba Jūs neturite privilegijų!"); } return 1; } |
#include <a_samp>
#include <zcmd>
new countvar = 10;
new CountDownTimer;
CMD:countdown(playerid, params[])
{
CountDownTimer = SetTimer("CountDown", 1000, true);
SetPlayerRaceCheckpoint(playerid, 1, -77.6183, 2501.9719, 15.4608, 0.0, 0.0, 0.0, 50.0);
return 1;
}
forward CountDown();
public CountDown()
{
countvar--;
new str[6];
if(countvar == 0)
{
GameTextForAll("~g~G~r~O~b~!", 3000, 5);
KillTimer(CountDownTimer);
countvar = 4;
}
else
{
format(str, sizeof(str), "%d", countvar);
GameTextForAll(str, 1000, 5);
}
}
GameTextForAll("~g~G~r~O~b~!", 3000, 5);
for(new i; i < MAX_PLAYERS; i++)
{
SetPlayerRaceCheckpoint(i, 0, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size);
}