29.07.2010, 23:09
here if i do /tk it returns this and there is someone near me with a wanted lvl..
whole cmd
pawn Код:
if(closest == -1 || GetDistanceBetweenPlayers(playerid,closest) > 10) return SendClientMessage(playerid,COLOR_RED,"There are no players closes enough to issue a ticket");
pawn Код:
CMD:ticket(playerid,cmdtext[])
{
new string[128],tmp[256],idx,giveplayerid;
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid, COLOR_RED,OnlyAlive);
if(gTeam[playerid] != 1 && gTeam[playerid] != 2) return SendClientMessage(playerid, COLOR_RED,NoUseWSkill);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
new closest = GetClosestTicketable(playerid);
if(closest == -1 || GetDistanceBetweenPlayers(playerid,closest) > 10) return SendClientMessage(playerid,COLOR_RED,"There are no players closes enough to issue a ticket");
new officer[30], suspect[30], skill[20];
GetPlayerName(playerid,officer,30);
GetPlayerName(closest,suspect,30);
if(gTeam[playerid] == 1) {
format(skill,sizeof(skill),"SA Army Officer");
}
else if(gTeam[playerid] == 2) {
format(skill,sizeof(skill),"Police Officer");
}
// Officer Stuff
format(string,sizeof(string),"You have issued a ticket to suspect %s(%d). Wait around to see if they pay",suspect,closest);
SendClientMessage(playerid,PURPLE,string);
// Suspect Stuff
format(string,sizeof(string),"%s %s(%d) Has issued a ticket to you! Type /pay or your wanted level might increase",skill,officer,playerid);
SendClientMessage(closest,PURPLE,string);
TicketPlayer(closest);
PlayerInfo[playerid][Tickets]++;
return 1;
}
new stringLength = strlen(tmp);
if(stringLength >= 49) return 0;
if(IsNumeric(tmp))
{
giveplayerid = strval(tmp);
}
else
if(!IsNumeric(tmp))
{
giveplayerid = ReturnPlayer(tmp);
}
if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,NotOnYourself);
if(giveplayerid == -1) return SendClientMessage(playerid,COLOR_RED,"Multiple players found or none atall. Please narrow your search.");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_RED,NoActive);
if(IsPlayerNPC(giveplayerid)) return SendClientMessage(playerid,COLOR_RED,NotOnANPC);
if(GetDistanceBetweenPlayers(giveplayerid,playerid) > 10) return SendClientMessage(playerid, COLOR_RED,PlayerToFarAway);
if(gTeam[giveplayerid] <= 2) return SendClientMessage(playerid, COLOR_RED,"You cannot issue tickets to Police Officers, Medics, Casino Security or Army Officers");
if(IsSpawned[giveplayerid] == 0) return SendClientMessage(playerid, COLOR_RED,POnlyAlive);
if(GetPlayerWantedLevel(giveplayerid) <= 0) return SendClientMessage(playerid, COLOR_RED,"You cannot issue a ticket to that player. That player is innocent (Type /pc)");
if(GetPlayerWantedLevel(giveplayerid) >= 4) return SendClientMessage(playerid, COLOR_RED,"You cannot issue a ticket to that player. That player's wanted level is too high! Use /arrest (id/name) instead");
if(PlayerHasReceivedATicket[playerid] != 0) return SendClientMessage(playerid, COLOR_RED,"That player has an outstanding ticket to pay. Stay nearby to see if he pays the ticket");
new officer[30], suspect[30], skill[20];
GetPlayerName(playerid,officer,30);
GetPlayerName(giveplayerid,suspect,30);
if(gTeam[playerid] == 1) {
format(skill,sizeof(skill),"SA Army Officer");
}
else if(gTeam[playerid] == 2) {
format(skill,sizeof(skill),"Police Officer");
}
// Officer Stuff
format(string,sizeof(string),"You have issued a ticket to suspect %s(%d). Wait around to see if they pay",suspect,giveplayerid);
SendClientMessage(playerid,PURPLE,string);
// Suspect Stuff
format(string,sizeof(string),"%s %s(%d) Has issued a ticket to you! Type /pay or your wanted level might increase",skill,officer,playerid);
SendClientMessage(giveplayerid,PURPLE,string);
TicketPlayer(giveplayerid);
PlayerInfo[playerid][Tickets] ++;
return 1;
}