27.04.2018, 12:19
PHP код:
CMD:pay(playerid, params[])
{
if(HasBeenIssuedTicket{playerid} == true)
{
new fine = random(10000) + 1000;
if(fine > GetPlayerCash(playerid))
{
if( GetPlayerMoney(playerid) < fine) return SendClientMessage(playerid, COLOR_RED, "{ff0000}ERROR : {ffffff}You don't have enough money to pay the ticket! RUN RUN !");
KillTimer(TicketTimer{playerid});
HasBeenIssuedTicket{playerid} = false;
format(fstr, sizeof(fstr), "[DISPATCH]: Suspect %s [%d] has payed the ticket.", GetName(playerid), playerid);
CopRadio(BLUE, fstr);
format(fstr2, sizeof(fstr2), "Ticket paid {33FF33}$%d{FFFFFF}. Innocent civilian status achieved.", fine);
GameTextForPlayer(playerid, "~G~TICKET PAID", 5000, 5);
SetPlayerColor(playerid, COLOR_WHITE);
SendClientMessage(playerid, RED, fstr2);
format(fstr2, sizeof(fstr2), "The suspect has payed the ticket, you got paid $%d.", fine);
GameTextForPlayer(TicketIssuer[playerid], "~B~TICKET PAYED", 2500, 5);
SendClientMessage(TicketIssuer[playerid], YELLOW, fstr2);
GivePlayerMoney(playerid, -fine);
GivePlayerMoney(TicketIssuer[playerid], fine);
SetPlayerWantedLevel(playerid, 0);
SetPlayerScore(TicketIssuer[playerid], GetPlayerScore(TicketIssuer[playerid]) + 1);
SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
PlayerInfo[TicketIssuer[playerid]][aTickets] ++;
PlayerInfo[playerid][aFined] ++;
TicketIssuer[playerid] = -1;
}
else
{
SendClientMessage(playerid, RED, "{FF0000}[ERROR]: {ffffff}You dont have engouh money to pay.");
}
}
else
{
SendClientMessage(playerid, RED, "You have not been issued a ticket.");
}
return true;
}