25.02.2009, 00:16
i made this , arrest cmd but i got errors :S
heres the code:
and heres the errors
heres the code:
pawn Код:
if(strcmp("/arrest", cmdtext, true, 7) == 0)
{
if(gTeam[playerid] != TEAM_COP) return SendClientMessage(playerid, COLOR_RED, "You Are Not A Cop. Only Cops Can Use This Command.");
if(strlen(cmdtext[8]) == playerid) return SendClientMessage(playerid,COLOR_RED,"You Cannot Arrest Yourself, Idoit.");
if(strlen(cmdtext[8]) == 0){
new closest[MAX_PLAYERS];
new closestlvl;
closest = GetClosestPlayer(0);
closestlvl = GetPlayerWantedLevel(closest);
if(closestlvl < 4)
{
new copname[MAX_PLAYER_NAME];
new cmdname[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, copname, sizeof(cmdname));
GetPlayerName(strval(cmdtext[8]), cmdname, sizeof(cmdname));
format(string, sizeof(string), "%s (%d) Has Been Arested By Officer %s (%d)", cmdname,strval(cmdtext[8]),copname,playerid);
SendClientMessageToAll(COLOR_PURPLE, string);
new rand;
rand = random(sizeof(AJail));
SetPlayerInterior(strval(cmdtext[8]), 3);
SetPlayerPos(strval(cmdtext[8]), AJail[rand][0], AJail[rand][1], AJail[rand][2]);
gPlayerJailed[playerid] = 1;
SetPlayerWantedLevel(strval(cmdtext[8]),0);
return 1;
} else return SendClientMessage(playerid,COLOR_RED,"No Wanted Players Close Enough TO Arrest.");
return 1;
}
return 1;
}
Код:
C:\Users\Ethan\Desktop\SAMPSERVER\gamemodes\Untitled.pwn(1518) : error 033: array must be indexed (variable "closest") C:\Users\Ethan\Desktop\SAMPSERVER\gamemodes\Untitled.pwn(1519) : error 035: argument type mismatch (argument 1) C:\Users\Ethan\Desktop\SAMPSERVER\gamemodes\Untitled.pwn(1544) : warning 225: unreachable code Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.