20.11.2012, 14:41
I need some help on changing the command into a key . Example if someone press shift he does that command .
I wanna that if player press the "shift" button , all this happends ..
PHP код:
dcmd_pay(playerid,params[])
{
#pragma unused params
new rand = random(GetPlayerMoney(playerid)),Float:x,Float:y,Float:z,string[100];
while(rand > GetPlayerMoney(playerid))
if(gTeam[playerid] != TEAM_POLICE) return SendClientMessage(playerid,red,"ERROR: "lgrey"You aren't a police man!");
if(hastickettopay[playerid] == 0) return SendClientMessage(playerid,red,"You dont have a ticket to pay!");
if(GetPlayerWantedLevel(playerid) > 2) return SendClientMessage(playerid,red,""lgrey"You cant pay your ticket! You have a high wanted level"lyellow2"(/arrest)");
format(string,sizeof(string),""lred"You aren't near "lyellow2"%s",GetPName(Ticketid[playerid]));
GetPlayerPos(Ticketid[playerid],x,y,z);
if(IsPlayerInRangeOfPoint(playerid,10.0,x,y,z)) return SendClientMessage(playerid,red,string);
GivePlayerMoney(Ticketid[playerid],rand);
GivePlayerMoney(playerid,-rand);
KillTimer(Ticket[playerid]);
hastickettopay[playerid] = 0;
SendFMessage(playerid,red,"",GetPName(Ticketid[playerid]),rand);
SendFMessage(Ticketid[playerid],red,"%s has paid $%i for his ticket",GetPName(playerid),rand);
return 1;
}