WHAT THE **** is wrong here? -
Cjgogo - 22.05.2011
I'm trying to make arrest command for button,BUT THE ONLY THING I MANAGE TO DO IS ARRESTING MYSELF WHEN I'M WANTE,WHAT"S WRONG?
pawn Код:
if(newkeys == KEY_LOOK_BEHIND)
{
if(gTeam[playerid] == TEAM_COPS)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
new p1 = i;
new p2 = i++;
if(GetDistanceBetweenPlayers(p1,p2) > 4) return SendClientMessage(playerid,COLOR_WHITE,"Nobody is close enough");
if(GetDistanceBetweenPlayers(p1,p2) <= 4 && GetPlayerWantedLevel(p2) > 0)
{
TogglePlayerControllable(p2,0);
new copname[24];
new wantedname[24];
GetPlayerName(p1,copname,sizeof(copname));
GetPlayerName(p2,wantedname,sizeof(wantedname));
new string[128];
format(string,sizeof(string),"%s has been cuffed by %s",wantedname,copname);
SendClientMessageToAll(COLOR_GREY,string);
GivePlayerMoney(p1,500);
}
}
}
}
Re: WHAT THE **** is wrong here? -
(SF)Noobanatior - 22.05.2011
this isnt finding the player closest to you new p2 = i++;
Re: WHAT THE **** is wrong here? - [L3th4l] - 22.05.2011
Try this code:
pawn Код:
if(newkeys == KEY_LOOK_BEHIND)
{
if(gTeam[playerid] == TEAM_COPS)
{
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i) && GetPlayerWantedLevel(i) > 0)
{
new
Float:i_Pos[3];
GetPlayerPos(i, i_Pos[0], i_Pos[1], i_Pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 5, i_Pos[0], i_Pos[1], i_Pos[2]))
{
new
i_NameWanted[MAX_PLAYER_NAME],
i_NameCop[MAX_PLAYER_NAME],
iStr[48 + 20];
TogglePlayerControllable(i, false);
GetPlayerName(i, i_NameWanted, MAX_PLAYER_NAME]);
GetplayerName(playerid, i_NameCop, MAX_PLAYER_NAME);
format(iStr, sizeof(iStr), "%s(%d) has been cuffed by %s(%d)", i_NameWanted, i, i_NameCop, playerid);
SendClientMessageToAll(COLOR_GREY, iStr);
GivePlayerMoney(playerid, 500);
return 1;
}
else SendClientMessage(playerid, COLOR_WHITE, "Nobody is close enough.");
}
}
}
}
I cannot guarantee that it will work + I'm sleepy. Good night.
Re: WHAT THE **** is wrong here? -
Cjgogo - 22.05.2011
I get errors only here
pawn Код:
GetPlayerName(playerid, i_NameCop, MAX_PLAYER_NAME);
Re: WHAT THE **** is wrong here? -
Haydz - 22.05.2011
it's the line above that
pawn Код:
GetPlayerName(i, i_NameWanted, MAX_PLAYER_NAME]);
GetplayerName(playerid, i_NameCop, MAX_PLAYER_NAME);
// he missed a capital P in GetPlayerName.
Make that p a capital and it should work.
Re: WHAT THE **** is wrong here? -
boelie - 22.05.2011
under your
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
add this
now you wont arrest yourself cuz it skips 'playerid' the rest of your code seemed okay to me
Re: WHAT THE **** is wrong here? -
xir - 22.05.2011
pawn Код:
GetPlayerName(i, i_NameWanted, MAX_PLAYER_NAME);
GetPlayerName(playerid, i_NameCop, MAX_PLAYER_NAME);
// Also the first GetPlayerName had a ]
Re: WHAT THE **** is wrong here? -
Cjgogo - 22.05.2011
still arresting mysself(WTF?)but i'll try to re-script it later for now i'm busy with making the robbery system(is done and is working perefectly just that right when I take a turn on a car i discover 1 mroe shop wich I forgot to add :P)