CMD:chase(playerid, params[]) { if(PlayerInfo[playerid][pFaction] == LSPD) { new string[128]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); SetTimer(Pursuit(playerid), 5000, true); format(string, sizeof(string), "Dispatcher: All units be advised there is a pursuir on behave of %s!", sendername); SendFactionMessage(LSPD, COLOR_BLUE, string); } else { SendClientMessage(playerid, COLOR_RED, "You are not a LEO!"); } }
error 035: argument type mismatch (argument 1)
SetTimer(Pursuit(playerid), 5000, true);
public Pursuit(playerid) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); SetPlayerCheckpoint(x, y, z, 5); }
CMD:killchase(playerid, params[]) { if(PlayerInfo[playerid][pFaction] == LSPD) { KillTimer(Pursuit(playerid)); } }
new
Pursuit_Timer[MAX_PLAYERS] = {-1, ...};
// OnPlayerConnect:
Pursuit_Timer[playerid] = -1;
forward Pursuit(playerid);
public Pursuit(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for (new i; i != MAX_PLAYERS; ++i) if (PlayerInfo[i][pFaction] == LSPD) SetPlayerCheckpoint(i, x, y, z, 5);
}
CMD:chase(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == LSPD)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
Pursuit_Timer[playerid] = SetTimer("Pursuit", 5000, true, "i", playerid);
format(string, sizeof(string), "Dispatcher: All units be advised there is a pursuir on behave of %s!", sendername);
SendFactionMessage(LSPD, COLOR_BLUE, string);
}
else SendClientMessage(playerid, COLOR_RED, "You are not a LEO!");
return 1;
}
CMD:killchase(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == LSPD)
{
KillTimer(Pursuit_Timer[playerid]);
}
return 1;
}
// First one
// Top of your GM
new pursuitTimer[MAX_PLAYERS] = 0;
CMD:chase(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == LSPD)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
pursuitTimer[playerid] = SetTimer("Pursuit", 5000, true);
format(string, sizeof(string), "Dispatcher: All units be advised there is a pursuir on behave of %s!", sendername);
SendFactionMessage(LSPD, COLOR_BLUE, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not a LEO!");
}
}
// I've just removed the (playerid) of the timer. The public function is forwarded so the playerid here is useless and the compiler gives you this error.
// Second one
KillTimer(pursuitTimer[playerid]);
// Timerid doesn't mean function name that the timer call.
// You need to create a var with new, and to assign the var to the timer when you use SetTimer.
// It also works for SetTimerEx.
SetTimer(Pursuit(playerid), 5000, true);
SetTimer("Pursuit", 5000, true);
CMD:killchase(playerid, params[]) { if(PlayerInfo[playerid][pFaction] == LSPD) { KillTimer(Pursuit_Timer[playerid]); } return 1; }
CMD:killchase(playerid, params[]) { if(PlayerInfo[playerid][pFaction] == LSPD) { KillTimer("Pursuit"); } return 1; }
Just change this
Код:
SetTimer(Pursuit(playerid), 5000, true); Код:
SetTimer("Pursuit", 5000, true); |