15.07.2010, 06:32
how do i make it new randommoney once and use it for both commands
new Ticket[MAX_PLAYERS];
new TicketTo[MAX_PLAYERS];
new TicketFrom[MAX_PLAYERS];
new Paid[MAX_PLAYERS];
i njust posted the code cus i wanted if anyone sees a error they could help<.<
new Ticket[MAX_PLAYERS];
new TicketTo[MAX_PLAYERS];
new TicketFrom[MAX_PLAYERS];
new Paid[MAX_PLAYERS];
pawn Код:
CMD:ticket(playerid, params[])
{
new giveplayerid;
new randmoneyt = random(1500);
if (sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Usage: /Ticket [ID]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Invalid ID");
if (GetPlayerWantedLevel(giveplayerid) == 0) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Is Not A Suspected Player");
if (TicketTo[playerid]!=999) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Already Has A Ticket.");
if (TicketFrom[giveplayerid] != 999) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Already Has A Ticket");
if (GetPlayerWantedLevel(giveplayerid) > 3) return SendClientMessage(playerid, 0xFF0000AA, "Error: %s(%d) Does Not Have A Warrant Please Use /tk [playerid]");
if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF0000AA, "Only Police Officers May Ticket Other Players");
TicketTo[playerid] = giveplayerid;
TicketFrom[giveplayerid] = playerid;
new string[128];
SendClientMessage(giveplayerid, niceblue, "[INFO] Do /pay To Pay The Ticket!");
format(string, sizeof(string), "~w~You Have Been Issued A Ticket Of ~n~~y~[%d] ~w~Type /Pay To Pay The ~n~Ticket",randmoneyt);
GameTextForPlayer(playerid,string,7000,3);
timer = SetTimerEx("increasewl",30000,0,"i",playerid);
Paid[playerid] = 0;
return 1;
}
CMD:pay(playerid, params[])
{
new giveplayerid,string[128];
TicketTo[playerid] = giveplayerid;
TicketFrom[giveplayerid] = playerid;
if (GetPlayerWantedLevel(giveplayerid) == 0) return SendClientMessage(playerid, NEWRED, " You Don't Have A Wanted Level, You Don't Have To Pay Any Tickets");
if (GetPlayerMoney(giveplayerid))
{
format(string, sizeof(string), "You Don't Have Enough Money To Pay The Ticket(%d)",randmoneyt);
}
if(gTeam[playerid] == TEAM_CIVILIAN)
{
if(Paid[playerid] = 0)
{
new bname[128];
GetPlayerName(playerid, bname, sizeof(bname));
GivePlayerMoney(playerid, randmoneyt);
SetPlayerWantedLevel(playerid, 0);
TicketTo[TicketFrom[playerid]] = 999;
Ticket[playerid] = 0;
TicketFrom[playerid] = 999;
KillTimer(timer);
Paid[playerid] = 1;
}
}
return 1;
}
forward increasewl(playerid);
public increasewl(playerid)
{
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
new string[128];
SetPlayerWantedLevel(playerid,5);
SendClientMessage(playerid,NEWRED,"You Failed To Pay The Ticket Wanted Level Increased!");
format(string, sizeof(string), "COMMITED A CRIME: SUSPECT [%s][%d] Has Not Paided His Ticket !", Playername(playerid));
SendClientMessageToAll(VIOLET, string);
return 1;
}