/tk... help. -
Hello everyone there a are no problem but i want to add timer for ticket timer for someone payed it.
PHP код:
COMMAND:tk(playerid,params[])
{
new pId;
new pskin = GetPlayerSkin(playerid);
if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
{
if(sscanf(params, "d", pId)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /tk [ID]");
else if(!IsPlayerConnected(pId)) return SendClientMessage(playerid, 0xFF0000AA, "[WARRING]:- The Player is not Connected/Invaild ID.");
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(pId, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 12.0, x, y, z))
{
new pname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME], string1[250];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(pId, aname, sizeof(aname));
if (GetPlayerWantedLevel(pId) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "{952C35}[WARRING]{FFFFFF}: This player is not wanted to ticket him.");
return 1;
}
else if (GetPlayerWantedLevel(pId) == 1 & 3)
{
SendClientMessage(pId, 0xFF0000AA, "[PAYED]:- The Player has been payed his ticket. [automacily].");
GivePlayerMoney(pId, -3500);
GameTextForPlayer(pId, "~b~Ticket Payed", 5000, 3);
GivePlayerMoney(playerid, 3500);
SendClientMessage(playerid, 0xFF0000AA, "[Getting]: You have got $3500, The player payed his ticket.");
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
SetPlayerWantedLevel(pId, 0);
SetPlayerColor(pId, COLOR_WHITE);
format(string1, sizeof(string1), "%s(%d) Has Recieved A Ticket From Officer {0080FF}%s(%d)", aname, pId, pname, playerid);
SendClientMessageToAll(0xFF0000AA, string1);
return 1;
}
else if (GetPlayerWantedLevel(pId) > 1)
{
SendClientMessage(playerid, 0xFF0000AA, "{952C35}[WARRING]{FFFFFF}: You can ticket this player type /ticket.");
return 1;
}
}
}
}
else
{
return SendClientMessage(playerid, 0xFF0000AA, "{FF0017}[ERROR]{FFFFFF}: Only Cops can use this command.");
}
return 1;
}
Re: /tk... help. -
PHP код:
//Countdown timer
new TKCountDown[MAX_PLAYERS];
new TKTimer[MAX_PLAYERS];
//somewhere in your tk code
TKCountdown[pID] = 25;
TKTimer[pID] = SetTimerEx("TicketCountdown", "1000", true, "d", pID");
//Create your custom forward public function
forward TicketWait(playerid);
public TicketWait(playerid)
{
if(TicketCountDown[playerid] > 0)
{
TicketCountDown[playerid]--;
}
else
{
KillTimer(TicketTimer[playerid])
//Your code here. or simply the warning thing
}
}
CMD:pay(playerid, params[])
{
//Your code here
//In The end part
KillTimer(TicketTimer[pID]);
TicketCountDown[pID] = 0;
return 1;
}