arrest commands
#1

I made a arrest cmd and i made it if 4-5 cops is on rangeofplayer and 1 cop arrest a criminals so they all cops cops get money and score too only who cops get it who on rangeof player point

there is my cmd:

Код:
CMD:ar(playerid, params[])
{
	new rangepass = 0, vehiclepass = 0, wantedpass = 0, dutypass = 0, eventpass = 0, arrestpass = 0;
    if(GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "Only law enforcement can arrest players.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You cant arrest players from a vehicle.");
	foreach(Player, i)
	{
	    if(i == playerid) continue;
	    new Float:x, Float:y, Float:z;
    	GetPlayerPos(i, x, y, z);
    	new Float:hp;
    	GetPlayerHealth(i, hp);
    	if(hp > 0.0)
    	if(IsPlayerInRangeOfPoint(i, 10.0, x, y, z) && GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
    	{
    	 	rangepass++;
			if(GetPlayerWantedLevel(i) >= 4)
			{
				wantedpass++;
				if(!IsPlayerInAnyVehicle(i))
				{
			    	vehiclepass++;
					if(IsOnduty{i} == 0)
					{
					    dutypass++;
						if(IsAtEvent{i} == 0)
						{
                            eventpass++;
							if(HasBeenArrested{i} == false)
							{
							    arrestpass++;
							    if(GetTeam{playerid} == CLASS_COPS)
								{
									PlayerInfo[i][pArrests] ++;
									TogglePlayerControllable(i, false);
									GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
									format(fstr, sizeof(fstr), "Officer %s [%d] has just arrested you.", GetName(playerid), playerid);
									SendClientMessage(i, COLOR_AQUA, fstr);
									GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
        							SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
									new pay = random(10000) + 5000;
        							GivePlayerCash(playerid, pay);
        							PlayerInfo[playerid][pTakedowns] ++;
        							ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
									format(fstr2, sizeof(fstr2), "Suspect %s [%d] has been arrested by Officer %s [%d]", GetName(i), i, GetName(playerid), playerid);
									SendClientMessageToAll(COLOR_AQUA, fstr2);
									SetPlayerScore(i, GetPlayerScore(i) - 1);
									SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
									SetTimerEx("SendPlayerToJail", 3000, false, "d", i);
									HasBeenArrested{i} = true;

         							break;
								}
								else if(GetTeam{playerid} == CLASS_CIA)
								{
									PlayerInfo[i][pArrests] ++;
									TogglePlayerControllable(i, false);
									GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
									SendClientMessage(i, COLOR_AQUA, "You have been arrested by a Undercover CIA Agent.");
									GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
        							SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        							new pay = random(10000) + 5000;
        							GivePlayerCash(playerid, pay);
        							PlayerInfo[playerid][pTakedowns] ++;
        							ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
									format(fstr, sizeof(fstr), "Suspect %s [%d] has been arrested by a Undercover CIA Agent.", GetName(i), i);
									SendClientMessageToAll(COLOR_AQUA, fstr);
									SetPlayerScore(i, GetPlayerScore(i) - 1);
									SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
									SetTimerEx("SendPlayerToJail", 3000, false, "d", i);
									HasBeenArrested{i} = true;

         							break;
								}
								else if(GetTeam{playerid} == CLASS_FBI)
								{
									PlayerInfo[i][pArrests] ++;
									TogglePlayerControllable(i, false);
									GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
									SendClientMessage(i, COLOR_AQUA, "You have been arrested by a Undercover FBI Agent.");
									GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
        							SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        							new pay = random(10000) + 5000;
        							GivePlayerCash(playerid, pay);
        							PlayerInfo[playerid][pTakedowns] ++;
        							ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
									format(fstr, sizeof(fstr), "Suspect %s [%d] has been arrested by a Undercover FBI Agent.", GetName(i), i);
									SendClientMessageToAll(COLOR_AQUA, fstr);
									SetPlayerScore(i, GetPlayerScore(i) - 1);
									SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
									SetTimerEx("SendPlayerToJail", 3000, false, "d", i);
									HasBeenArrested{i} = true;

         							break;
								}
								else if(GetTeam{playerid} == CLASS_ARMY)
								{
									PlayerInfo[i][pArrests] ++;
									TogglePlayerControllable(i, false);
									GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
									SendClientMessage(i, COLOR_AQUA, "You have been arrested by a  Army Soldier.");
									GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
        							SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        							new pay = random(10000) + 5000;
        							GivePlayerCash(playerid, pay);
        							PlayerInfo[playerid][pTakedowns] ++;
        							ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
									format(fstr, sizeof(fstr), "Suspect %s [%d] has been arrested by a Army Soldier.", GetName(i), i);
									SendClientMessageToAll(COLOR_AQUA, fstr);
									SetPlayerScore(i, GetPlayerScore(i) - 1);
									SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
									SetTimerEx("SendPlayerToJail", 3000, false, "d", i);
									HasBeenArrested{i} = true;

         							break;
								}
							}
						}
					}
				}
			}
		}
	}
	if(rangepass == 0)
	{
		SendClientMessage(playerid, RED, "No wanted players in range.");
	}
	else if(wantedpass == 0)
	{
		SendClientMessage(playerid, RED, "No wanted players in range.");
	}
	else if(vehiclepass == 0)
	{
		SendClientMessage(playerid, RED, "No wanted players in range.");
	}
	else if(dutypass == 0)
	{
		SendClientMessage(playerid, RED, "No wanted players in range.");
	}
	else if(eventpass == 0)
	{
		SendClientMessage(playerid, RED, "No wanted players in range.");
	}
	else if(arrestpass == 0)
	{
		SendClientMessage(playerid, RED, "No wanted players in range.");
	}
	new astring[100];
	format(astring, sizeof(astring),"%s [%d] typed: /ar", GetName(playerid), playerid);
	SendAdminMessage(GREY, astring);
	return true;
}
Reply
#2

Can you clean up that formatting so we can read it easier? Also, what is it that you need help with?
Reply
#3

Quote:
Originally Posted by SKAzini
Посмотреть сообщение
Can you clean up that formatting so we can read it easier? Also, what is it that you need help with?
U can copy it and past it on pawn for helping me and I want if a cop arrest a criminal so near cops get money and score too.
Reply
#4

pls i need help rly? i think there is pro scripter so where r u man? solive my problem and help me man.
Reply
#5

What I suggest you to do is read the Wiki for PAWN and SA-MP API tutorials. The code that you posted is copy-and-pasted, which will learn you nothing at all. Learn some server scripting and make your own system, making your own system will always be the most personalized system to your needs.

https://sampwiki.blast.hk/wiki/Scripting_Basics

What I did to become a good scripter was to read the basics (above link), try out new things, test if things would work and then I would advance in scripting knowledge, I did not ask for a whole script. If you want a whole script, someone would probably want to get paid for doing the work.
Reply
#6

read wiki
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)