pawn Код:
//----------------------------------[SetCrim]-----------------------------------------------
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (IsACop(playerid))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
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;
result[0] = toupper(result[0]);
if(!strlen(result)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
//if (gTeam[playa] == 2 || IsACop(playa)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "You can't suspect a cop");
if(money > 10) return SendClientMessage(playerid, COLOR_GRAD1, "Maximum wanted level is 10!");
if(money == 0) return SendClientMessage(playerid, COLOR_GRAD1, "Minimum wanted level is 0!");
if(WantedLevel[playa] == 10) return SendClientMessage(playerid, COLOR_GRAD1, "That player already have wanted level 10");
if(WantedLevel[playa] + money > 10) { WantedLevel[playa] = 10; } else { WantedLevel[playa] += money; }
SetPlayerWantedLevel(playa, WantedLevel[playa]);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You've commited a Crime ( %s )[+%d]. Reporter: %s.",result,money,sendername);
SendClientMessage(playa, COLOR_LIGHTRED, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3)
{
format(string, sizeof(string), "HQ: All units APB: Reporter: %s",sendername);
SendClientMessage(i, COLOR_DBLUE, string);
format(string, sizeof(string), "HQ: Crime: %s[+%d] , Suspect: %s .",result,money,giveplayer);
SendClientMessage(i, COLOR_DBLUE, string);
format(string1, sizeof(string), "%s has gave wanted %d to %s", sendername, money, giveplayer);
WantedLog(string1);
ABroadCast(COLOR_YELLOW,string1,1);
}
}
}
}
}
} else return SendClientMessage(playerid, COLOR_GREY, "You aren't part of an cop organization.");
}
return 1;
}
if(strcmp(cmd, "/store", true) == 0)
pawn Код:
public WantedLog(string[])
{
new entry[256];
format(entry, sizeof(entry), "%s\n",string);
new File:hFile;
hFile = fopen("logs/wanted.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}