02.08.2018, 10:22
Hi, Help me
ID 0 and 1 = PD
https://imgur.com/8vAkR4P
=======================
How To Fix Accept Ticket?
https://imgur.com/pyXc0rA
/ticket [playerid] [price] [reason]
/accept ticket [playerid]
ID 0 and 1 = PD
https://imgur.com/8vAkR4P
=======================
How To Fix Accept Ticket?
https://imgur.com/pyXc0rA
/ticket [playerid] [price] [reason]
Код:
if(strcmp(cmd, "/ticket", true) == 0) { if(IsPlayerConnected(playerid)) { if(!IsAPDMember(playerid)) { SendMessage(playerid, COLOR_BLUE, "You are not a Police Department."); return 1; } if(OnDuty[playerid] != 1) { SendMessage(playerid, COLOR_BLUE, "You are not On-Duty."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendMessage(playerid, COLOR_GRAD2, "USPGE: /ticket [playerid/PartOfName] [price] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendMessage(playerid, COLOR_GRAD2, "USPGE: /ticket [playerid/PartOfName] [price] [reason]"); return 1; } moneys = strval(tmp); if(moneys < 1 || moneys > 1000) { SendMessage(playerid, COL_SYN, "Ticket Money can't be below $1 or higher then $1,000"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if (ProxDetectorS(8.0, playerid, giveplayerid)) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendMessage(playerid, COLOR_GRAD2, "USPGE: /ticket [playerid/PartOfName] [price] [reason]"); return 1; } format(string, sizeof(string), "You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result)); SendMessage(playerid, COL_SYN, string); format(string, sizeof(string), "Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result)); SendMessage(giveplayerid, COL_SYN, string); format(string, sizeof(string), "Use /accept ticket %d, to accept ticket or cancel.",playerid); SCM(giveplayerid,COL_SYN,string); TicketOffer[giveplayerid] = playerid; TicketMoney[giveplayerid] = moneys; return 1; } else { SendMessage(playerid, COLOR_GREY, "That player is not near you."); return 1; } } } else { SendMessage(playerid, COLOR_GREY, "That player is Offline"); return 1; } } return 1; }
/accept ticket [playerid]
Код:
else if(strcmp(x_job,"ticket",true) == 0) { if(TicketOffer[playerid] < 9999) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SCM(playerid,COL_SYN,"Syntax: /accept ticket <PlayerID/PartOfName>"); return 1; } new giveplayers; giveplayers = ReturnUser(tmp); if(giveplayers != TicketOffer[playerid]) return SCM(playerid,COL_SYN,"That player doesn't offer you anything."); if(IsPlayerConnected(TicketOffer[playerid])) { if (ProxDetectorS(5.0, playerid, TicketOffer[playerid])) { GetPlayerName(TicketOffer[playerid], giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "You have paid the Ticket of $%d to Officer %s.", TicketMoney[playerid], giveplayer); SendMessage(playerid, COL_SYN, string); format(string, sizeof(string), "%s has paid your Ticket of $%d.", sendername, TicketMoney[playerid]); SendMessage(TicketOffer[playerid], COL_SYN, string); GivePlayerPool(playerid, - TicketMoney[playerid]); GivePlayerPool(TicketOffer[playerid], TicketMoney[playerid]); TicketOffer[playerid] = 9999; TicketMoney[playerid] = 0; return 1; } else { SendMessage(playerid, COLOR_GREY, "The Officer is not near you."); return 1; } } } else { SendMessage(playerid, COLOR_GREY, "No-one offered you a Ticket."); return 1; } }