if(strcmp(cmdtext, "/sf", true) == 0)
{
SetTimerEx("SFtele",5000,false,"i",playerid);
SendClientMessage(playerid, COLOR_WHITE,"** Wait 5 seconds...");
return 1;
}
public SFtele(playerid)
{
//there is my things and stuff.
return 1;
}
KillTimer(SFtele[playerid]);
new teleSF;
if(strcmp(cmdtext, "/sf", true) == 0)
{
teleSF = SetTimerEx("SFtele",5000,false,"i",playerid);
SendClientMessage(playerid, COLOR_WHITE,"** Wait 5 seconds...");
return 1;
}
KillTimer(teleSF);
new
teleSF[ MAX_PLAYERS ]
;
if( !strcmp( cmdtext, "/sf", true ) )
{
teleSF[ playerid ] = SetTimerEx( "SFtele", 5000, false, "i", playerid );
SendClientMessage( playerid, COLOR_WHITE,"** Wait 5 seconds..." );
return 1;
}
KillTimer( teleSF[ playerid ] );
Like i said. it did command instantly. i just wanted to make killtimer to stop the timer and dont do command.
and why under on player state change? Its for car export. i made it like when you are in exportable car you cant teleport but my little brother found bug that if you type teleport command /sf before you enter the vehicle and then enter in vehicle you can teleport. so i needed it to put underonplayerstatechange. |
public OnPlayerStateChange(playerid,newstate,oldstate)
{
switch(newstate)
{
case PLAYER_STATE_PASSENGER:
{
if(GetPlayerWeapon(playerid) == 24 ) SetPlayerArmedWeapon(playerid,0);
}
}
if(oldstate == PLAYER_STATE_DRIVER)
{
if (locked[playerid][vehid[playerid]] == 1)
{
unlocktimer = SetTimerEx("unlock",300000,false,"ii",playerid,vehid[playerid]);
locked[playerid][vehid[playerid]] = 2;
}
}
if (newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid, 0);
if (locked[playerid][vehid[playerid]] == 2)
{
KillTimer(unlocktimer);
locked[playerid][vehid[playerid]] = 1;
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
SendClientMessage(playerid,COLOR_RED,"** This vehicle is locked.");
}
new newcar = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(newcar);
if (model == carselect[0] || model == carselect[1] || model == carselect[2])
{
KillTimer(teleLS);
KillTimer(teleLV);
KillTimer(teleSF);
KillTimer(teleCHILLIAD);
KillTimer(teleDRIFTLS);
KillTimer(teleDRIFTSF);
KillTimer(teleDRIFTLV);
KillTimer(teleARCH);
KillTimer(teleTRANS);
MiniMission[playerid] = CHECKPOINT_EXPORT;
SetTimer("ShowCheckpoint", 1000, 1);
SendClientMessage(playerid,COLOR_ORANGE,"You can export this vehicle in San Fierro!");
}
}
return 1;
}