Quote:
Originally Posted by [UG]Scripter
The Issue is, I'm setting the timer in one command a killing it in another.
|
I fail to see how you couldn't have just turned it in to a variable w/ MAX_PLAYER cells yourself...
pawn Код:
new
playerTimerHandle[MAX_PLAYERS];
dcmd_drag(playerid,params[])
{
new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PlayerTeam[playerid] == Team_NSP || PlayerTeam[playerid] == Team_LVPD) return SendClientMessage(playerid,ORANGE,"Law Enforcement command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /drag <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"%s Takes %s by the wrist and start's leading them",n,on);
playerTimerHandle[playerid] = SetTimerEx("Drag",2000,true,"i",id); // Sets Timer
return 1;
}
dcmd_stopdrag(playerid,params[])
{
new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PlayerTeam[playerid] == Team_NSP || PlayerTeam[playerid] == Team_LVPD) return SendClientMessage(playerid,ORANGE,"Law Enforcement command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /drag <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"%s Stops Leading %s",n,on);
TogglePlayerControllable(id,0);
KillTimer(playerTimerHandle[playerid]); // Kills timer
return 1;
}