24.03.2014, 08:24
Okay, SO I redid the code,
Hmm, I also got some warnings
pawn Код:
COMMAND:ar(playerid,params[])
{
new pId;
if(gTeam[playerid] == TEAM_COPS)
{
if(sscanf(params, "d", pId)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /ar [ID]");
else if(!IsPlayerConnected(pId)) return SendClientMessage(playerid, 0xFF0000AA, "The ID You Entered Was Not Found.");
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(pId, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 12.0, x, y, z))
{
new pname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME], string1[250], string2[256], string3[100], string4[100];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(pId, aname, sizeof(aname));
if (GetPlayerWantedLevel(pId) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "This Player Is Not Wanted!");
return 1;
}
else if (GetPlayerWantedLevel(pId) == 1)
{
SendClientMessage(playerid, 0xFF0000AA, "Error: this player has to high of a wanted level use /tk");
return 1;
}
else if (GetPlayerWantedLevel(pId) > 1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(pId, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) return SCM(playerid, COLOR_RED, "Not Close Enough to Arrest!");
new WantedLevel = GetPlayerWantedLevel(pId);
SetPlayerInterior(pId, 3);
new rand = random(sizeof(JailCellSpawns));
SetPlayerPos(pId, JailCellSpawns[rand][0], JailCellSpawns[rand][1], JailCellSpawns[rand][2]);
SetTimerEx("UnJail",WantedLevel*500*60,0,"i",pId);
InJail[pId] = 1;
GivePlayerMoney(pId, -WantedLevel*1000);
GivePlayerMoney(playerid, WantedLevel*1000);
SetPlayerWantedLevel(pId, 0);
format(string1, sizeof(string1), "%s(%d) Has Ben Arrested By Officer %s(%d)", aname, pId, pname, playerid);
SendClientMessageToAll(0xFF0000AA, string1);
format(string2, sizeof(string2), "You Have Ben Sent To Jail For %s Minuets For Having A Level %s Wanted Level!", WantedLevel, WantedLevel);
SendClientMessage(pId, 0xFF0000AA, string2);
format(string3, sizeof(string3), "You Have Recived A %s000 Bonus For Arresting A Level %s Suspect!", WantedLevel, WantedLevel);
SendClientMessage(playerid, 0xFF0000AA, string3);
format(string4, sizeof(string4), "You Have Payed A %s000 Penalty On Your Arrest For Having A %s Wanted Level!", WantedLevel, WantedLevel);
SendClientMessage(pId, 0xFF0000AA, string4);
return 1;
}
}
}
}
else
{
return SendClientMessage(playerid, 0xFF0000AA, "Error: You are not a police officer!");
}
return 1;
}
Код:
Current directory: C:\Users\Bradley\Desktop\SA-MP\gamemodes cnr.pwn(3021) : warning 219: local variable "x" shadows a variable at a preceding level cnr.pwn(3021) : warning 219: local variable "y" shadows a variable at a preceding level cnr.pwn(3021) : warning 219: local variable "z" shadows a variable at a preceding level Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Warnings. ================ READY ================