if (!strcmp("/fixveh", cmdtext, true))
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID = GetPlayerVehicleID(playerid);
RepairVehicle(VehicleID);
///// SHOW /////
TextDrawShowForPlayer(playerid,Text:Textdraw14);
TextDrawShowForPlayer(playerid,Text:Textdraw15);
SetTimerEx("delay",4000,false,"i",playerid); // delay is just a "dummy" function that returns 1
///// HIDE /////
TextDrawHideForPlayer(playerid,Text:Textdraw14);
TextDrawHideForPlayer(playerid,Text:Textdraw15);
return 1;
}
else
{
return 1;
}
}
GameTextForPlayer(playerid, "Fixed", 3000, 1);
forward delay(playerid);
if (!strcmp("/fixveh", cmdtext, true))
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID = GetPlayerVehicleID(playerid);
RepairVehicle(VehicleID);
///// SHOW /////
TextDrawShowForPlayer(playerid,Text:Textdraw14);
TextDrawShowForPlayer(playerid,Text:Textdraw15);
SetTimerEx("delay",4000,false,"i",playerid); // delay is just a "dummy" function that returns 1
return 1;
}
else
{
return 1;
}
return 1;
}
public delay(playerid)
{
///// HIDE /////
TextDrawHideForPlayer(playerid,Text:Textdraw14);
TextDrawHideForPlayer(playerid,Text:Textdraw15);
return 1;
}
... A timer is not a delay or sleep function, it calls the function you put ( "delay" ) after the set time ( 4 seconds )
|
Ok tell me if Im right,
once it gets to that timer line, it waits 4 seconds then executes the command in the string? and then after that command is done, it should return to the line after the timer line. If thats so, then my code should be working, as it is supposed to execute the delay function (dummy function) after the 4 seconds is up, but it seems its skipping the 4 seconds completely. |
public OnGameModeInit ( )
{
SetTimer( "ThisisaFunction", 1000, true );
return true;
}
forward ThisisaFunction ( );
public ThisisaFunction( )
{
print( "This timer is called once every second!" );
return true;
}