Timer problem -
GNGification - 20.03.2011
I just cannot find out why this timer isnt working... thanks for helping... I know old style...
__________________________________________________ _____________________________
forward AirStrikeTimer(playerid);
OnPlayerCommandText
{
if (strcmp("/AirStrike", cmdtext, true, 10) == 0)
{
if(KillStreak[playerid] == 0) //(Change) to 6
{
SetTimer("AirStike", 40000, 0);
SendClientMessage(playerid, red, "Incoming an AirStrike to your position in 40 seconds!");
return 1;
}
}
public AirStrikeTimer(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, Float:x, Float:y, Float:z);
CreateExplosion(Float:x, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y+5, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y+10, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y+15, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y+20, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y+25, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y+30, Float:z, 2, 10.0);
CreateExplosion(Float:x+5, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x+10, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x+15, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x+20, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x+25, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x+30, Float:y, Float:z, 2, 10.0);
CreateExplosion(Float:x, Float:y, Float:z+5, 2, 10.0);
return 1;
}
I havent made timers for a LONG time and now I cannot find a reason so thank you if you help me! :D
Re: Timer problem -
ricardo178 - 20.03.2011
use [pawn] tags
Re: Timer problem -
Zh3r0 - 20.03.2011
Because the function you call in the SetTimer doesn't match the one you want to be called.
Re: Timer problem -
GNGification - 20.03.2011
Should it be...
SetTimer("AirStikeTimer", 40000, 0); ?
Re: Timer problem -
ricardo178 - 20.03.2011
Yes, i think so by the way use the tags [pawn] when you post a script in this forum...
Re: Timer problem -
GNGification - 20.03.2011
Thank you and Yes I add pawn tags next time
Re: Timer problem -
Kwarde - 20.03.2011
Quote:
Originally Posted by GNGification
Should it be...
SetTimer("AirStikeTimer", 40000, 0); ?
|
No, the AirStrikeTimer contains a 'playerid' parameter:
pawn Код:
SetTimerEx("AirStrikeTimer", 40000, false, "i", playerid);
Re: Timer problem -
ricardo178 - 20.03.2011
SO it worked?
Re: Timer problem -
Biesmen - 20.03.2011
Also, you do not have to use 'Float' all the time.
pawn Код:
public AirStrikeTimer(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y, z, 2, 10.0);
CreateExplosion(x, y+5, z, 2, 10.0);
CreateExplosion(x, y+10, z, 2, 10.0);
CreateExplosion(x, y+15, z, 2, 10.0);
CreateExplosion(x, y+20, z, 2, 10.0);
CreateExplosion(x, y+25, z, 2, 10.0);
CreateExplosion(x, y+30, z, 2, 10.0);
CreateExplosion(x+5, y, z, 2, 10.0);
CreateExplosion(x+10, y, z, 2, 10.0);
CreateExplosion(x+15, y, z, 2, 10.0);
CreateExplosion(x+20, y, z, 2, 10.0);
CreateExplosion(x+25, y, z, 2, 10.0);
CreateExplosion(x+30, y, z, 2, 10.0);
CreateExplosion(x, y, z+5, 2, 10.0);
return 1;
}