Timer in command
#1

So this command is used to locate players with wanted levels(Suspects).I tried putting timer so it shows the suspect location 5 seconds after typing /loc command.I wanted it to look like this.
(Types /loc playerid)
Код:
Requesting intel on suspect..
[Location]Example was last reported seen at Idlewood.
Full cmd
Код:
CMD:loc(playerid, params[])
{
	new giveplayerid, string[256], giveplayer[25];
	if (GetPVarInt(playerid, "playerorg") != 0)
	{
		if(!IsALaw(playerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: You are not a law enforcer!");
	}
	else return SendClientMessage2(playerid, COLOR_RED, "Error: You are not a law enforcer!");
	if (GetPVarInt(playerid, "podfskin") == -1) return SendClientMessage2(playerid, COLOR_RED, "{FF5357}Error: {FFFFFF}You are off duty.");
	if (sscanf(params, "u", giveplayerid)) return SendClientMessage2(playerid, COLOR_ORANGE, "Usage: /loc [playerid]");
	if (!IsPlayerConnected2(giveplayerid)) return SendClientMessage2(playerid, COLOR_RED, "{FF5357}Error: {FFFFFF}Inactive player id!");
	GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
	if (GetPlayerWantedLevel(giveplayerid) == 0) return SendPlayerFormattedText(playerid, COLOR_RED, "{FF5357}Error: {FFFFFF}%s isn't a wanted player.", giveplayer, "");
	if (orcl[giveplayerid][0] != 0) return SendPlayerFormattedText(playerid, COLOR_RED, "Error: %s isn't spawned.", giveplayer, "");
 	SetTimer("Requesting intel on suspect...", 3000, false);
	if (playerZone[giveplayerid] > sizeof(zonenames)-11) SendPlayerFormattedText(playerid, COLOR_WHITE, "[Location] %s was last reported seen in %s.", giveplayer, zonenames[playerZone[giveplayerid]][z_name]);
	else
	{
		format(string, 128, "[location] %s was last reported seen in %s, %s.", giveplayer, zonenames[playerZone[giveplayerid]][z_name], zonenames[sizeof(zonenames)-(zonetype[playerZone[giveplayerid]]+1)][z_name]);
		SendClientMessage2(playerid, COLOR_WHITE, string);
	}
	return 1;
}
Never really used the timers,help me out please.Thanks in advance.
Reply


Messages In This Thread
Timer in command - by ItzColaBoi - 22.10.2017, 08:05
Re: Timer in command - by maksicnm - 22.10.2017, 08:36
Re: Timer in command - by Kraeror - 22.10.2017, 09:15
Re: Timer in command - by ItzColaBoi - 22.10.2017, 09:37
Re: Timer in command - by Kraeror - 22.10.2017, 09:37
Re: Timer in command - by ItzColaBoi - 22.10.2017, 13:07

Forum Jump:


Users browsing this thread: 1 Guest(s)