Timer issues
#1

i did this code it should send a warning message every 10 seconds and save player position and after 20 seconds there should be an explosion in the save x y z position of player

but i am not gettibg warning message and the explosion happen on my player even if i leave the old position where i get a warning.

this is my code

PHP Code:
// at the to
new Float:Pos[3][MAX_PLAYERS];
// gamemodeint
    
SetTimer("Airstrikemsg"100001); 
PHP Code:
public Airstrikemsg()
{
    
SendClientMessageToAll(-1"clear your position airstike coming!");
    for(new 
i=0;i<MAX_PLAYERS;i++)
    if(
IsPlayerConnected(i))
    {
        
GetPlayerPos(i,Pos[0][i],Pos[1][i],Pos[2][i]);
    }
    
SetTimer("Airstrikestart"200001);
    return 
1;
}
public 
Airstrikestart(playerid)
{
    
CreateExplosion(Pos[0][playerid], Pos[1][playerid], Pos[2][playerid], 71000.0);
    return 
1;

Reply
#2

Airstrikestart has a playerid argument, therefore it should be called with SetTimerEx("Airstrikestart", 20000, 1,"i",playerid);
Oh and well you don't have any playerid in Airstrikemsg, so if you want to airstrike a specific player, you should do it with i, or remove the playerid argument from airstrikestart and loop thru all players and blow them up.
Reply
#3

Quote:
Originally Posted by PrO.GameR
View Post
Airstrikestart has a playerid argument, therefore it should be called with SetTimerEx("Airstrikestart", 20000, 1,"i",playerid);
Oh and well you don't have any playerid in Airstrikemsg, so if you want to airstrike a specific player, you should do it with i, or remove the playerid argument from airstrikestart and loop thru all players and blow them up.
my problem is that i am not getting the warning mission warning mission is at airstrikemsg
Reply
#4

Try this.
PHP Code:
forward Airstrikemsg();
public 
Airstrikemsg() 

    
SendClientMessageToAll(-1"clear your position airstike coming!"); 
    
SetTimer("Airstrikestart"20000false); 
    return 
1

forward Airstrikestart();
public 
Airstrikestart() 

    for(new 
i=0;i<MAX_PLAYERS;i++) 
    {
        if(
IsPlayerConnected(i)) 
        {
            
GetPlayerPos(i,Pos[0][i],Pos[1][i],Pos[2][i]); 
            
CreateExplosion(Pos[0][i], Pos[1][i], Pos[2][i], 71000.0);
        } 
    }
    return 
1

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)