Timer Problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer Problem (
/showthread.php?tid=291709)
Timer Problem -
jiwan - 21.10.2011
i have made this command and when i run this it makes explosion with the timer of 6 seconds but it explodes area where the player is after 6 seconds i don't know where is error !
Код:
if ( !strcmp( "/cannonfire", cmdtext, true, 10 ) )
{
if( GetPlayerMoney(playerid) < 10000 ) return SendClientMessage( playerid, 0xFF0000FF, "You dont have Enough Money For a Cannon Strike" );
else
{
SendClientMessage( playerid, 0x00FF00FF, "Cannon fire on your position in 6 Seconds and counting!" );
GivePlayerMoney( playerid, -10000 );
SetTimerEx( "CannonExplosion", 6000, false, "i", playerid );
}
return true;
}
and this
Код:
forward CannonExplosion(playerid);
public CannonExplosion(playerid)
{
new
Float: P[ 3 ];
GetPlayerPos( playerid, P[ 0 ], P[ 1 ], P[ 2 ] );
CreateExplosion( P[ 0 ] + random( 5 ), P[ 1 ] + random( 5 ), P[ 2 ] + random( 5 ), 6, 100.0 );
}
Re: Timer Problem -
iJumbo - 21.10.2011
just get the player pos in the command and store it in the timerex .. and make some like
CannonExplosion(playerid,X,y,Z);
Re: Timer Problem -
[DK]Dark_Knight - 21.10.2011
try
pawn Код:
if ( !strcmp( "/cannonfire", cmdtext, true, 10 ) )
{
if( GetPlayerMoney(playerid) < 10000 ) return SendClientMessage( playerid, 0xFF0000FF, "You dont have Enough Money For a Cannon Strike" );
else
{
new Float:P[3];
GetPlayerPos( playerid, P[ 0 ], P[ 1 ], P[ 2 ] );
SendClientMessage( playerid, 0x00FF00FF, "Cannon fire on your position in 6 Seconds and counting!" );
GivePlayerMoney( playerid, -10000 );
SetTimerEx( "CannonExplosion", 6000, false, "ifff", playerid, P[0], P[1], P[2] );
}
return true;
}
forward CannonExplosion(playerid, x, y, z);
public CannonExplosion(playerid, x, y, z)
{
CreateExplosion( x + random( 5 ), y + random( 5 ), z + random( 5 ), 6, 100.0 );
}