Arrest Key ...(Cops And Robbers)
#1

hello guys!
Look here, I tried to do when you press the key 2 arrest player around you! ... but... not work
Can you tell me what's wrong?

Код:
 if(newkeys == KEY_SUBMISSION)
	{
	new string[256];
	if(gTeam[playerid] == COP || gTeam[playerid] == SWAT || gTeam[playerid] == ARMY || gTeam[playerid] == FBI)
	{
	if(IsPlayerInAnyVehicle(playerid))
	{
    SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect if you are in a car");
    return 1;
    }
	for(new i;i<MAX_PLAYERS;i++)
	{
	if(GetDistanceBetweenPlayers(i,playerid) <= 10 && GetPlayerWantedLevel(i) >= 4)
	{
	new spawn = random(sizeof(PrisonSpawn)), string2[250], Float:health, copname[MAX_PLAYER_NAME], arrested[MAX_PLAYER_NAME];
    GetPlayerName(playerid, copname, sizeof(copname));
    GetPlayerName(i, arrested, sizeof(arrested));
    GetPlayerHealth(i, health);
	SendClientMessage(i, GREY, "|_| San Andreas Police Dept. |_|");
	format(string, sizeof(string), "Officer %s has arrested you.", copname);
	SendClientMessage(i, WHITE, string);
	ResetPlayerWeapons(i);
	SetPlayerPos(i, PrisonSpawn[spawn][0], PrisonSpawn[spawn][1], PrisonSpawn[spawn][2]);
	SetPlayerFacingAngle(i, PrisonSpawn[spawn][3]);
	SetCameraBehindPlayer(i);
	if(GetPlayerWantedLevel(i) >= 4 && GetPlayerWantedLevel(i) <= 5)
	{
	PrisonTime[i] = 60;
	GivePlayerMoney(playerid,25000);
	GivePlayerScore(playerid,1);
	}
	else if(GetPlayerWantedLevel(i) >= 6 && GetPlayerWantedLevel(i) <= 8)
	{
	PrisonTime[i] = 120;
	GivePlayerMoney(playerid,35000);
	GivePlayerScore(playerid,1);
	}
	else if(GetPlayerWantedLevel(i) >= 9 && GetPlayerWantedLevel(i) <= 11)
	{
	PrisonTime[i] = 180;
	GivePlayerMoney(playerid,45000);
	GivePlayerScore(playerid,2);
	}
	else if(GetPlayerWantedLevel(i) >= 12 && GetPlayerWantedLevel(i) <= 14)
	{
	PrisonTime[i] = 240;
	GivePlayerMoney(playerid,55000);
	GivePlayerScore(playerid,2);
	}
	else if(GetPlayerWantedLevel(i) >= 15)
	{
	PrisonTime[i] = 300;
	GivePlayerMoney(playerid,65000);
	GivePlayerScore(playerid,3);
	}
	SetPlayerWantedLevel(i, 0);
	SetPlayerInterior(i,3);
	SetPlayerHealth(i,99999);
	TogglePlayerControllable(i, true);
	SetPlayerJailed(i, true);
	format(string2, sizeof(string2), "Officer %s[ID:%d] arrested %s[ID:%d].", copname, playerid, arrested, i);
	Announce(string2);
	if(health <= 90)
	{
    SendClientMessage(i, GREY, "|_| San Andreas Police Dept. |_|");
    SendClientMessage(i, WHITE, "SAPD has given you some food.");
    SetPlayerHealth(i, health+10);
    ApplyAnimation(i, "FOOD", "EAT_Burger", 4.0, 0, 0, 0, 0, 0);
	}
	}
	}
	}
}
Код:
public Float:GetDistanceBetweenPlayers(p1,p2)
{
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) return -1.00;
	GetPlayerPos(p1,x1,y1,z1);
	GetPlayerPos(p2,x2,y2,z2);
	return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Reply


Messages In This Thread
Arrest Key ...(Cops And Robbers) - by Raul_Ro - 07.09.2010, 15:05
Re: Arrest Key ...(Cops And Robbers) - by nissan123 - 07.09.2010, 15:26
Re: Arrest Key ...(Cops And Robbers) - by [XST]O_x - 07.09.2010, 15:30
Re: Arrest Key ...(Cops And Robbers) - by Raul_Ro - 07.09.2010, 15:46
Re: Arrest Key ...(Cops And Robbers) - by [XST]O_x - 07.09.2010, 15:48
Re: Arrest Key ...(Cops And Robbers) - by Raul_Ro - 07.09.2010, 15:54
Re: Arrest Key ...(Cops And Robbers) - by LegendNissanGTR - 29.11.2010, 16:10

Forum Jump:


Users browsing this thread: 1 Guest(s)