SA-MP Forums Archive
Closest Player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Closest Player (/showthread.php?tid=309025)



Closest Player - DarkKillerWithPride<3 - 06.01.2012

Hey,

How would I get the closest police officer for a use to pay his ticket? This is my code:
pawn Код:
CMD:pay(playerid,params[])
{
    if(gTeam[playerid] == TEAM_CIVIL || PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(HasATicket[playerid] == 1)
        {
            new Rand1, Rand2, Rand3;
            Rand1 = random(5000);
            Rand2 = random(15000);
            Rand3 = random(30000);
            switch(GetPlayerWantedLevel(playerid))
            {
                case 0: SendClientMessage(playerid,COLOR_RED,"You are not currently wanted.");
                case 1: GivePlayerMoney(playerid,Rand1);
                case 2: GivePlayerMoney(playerid,Rand2);
                case 3: GivePlayerMoney(playerid,Rand3);
            }
        }
        else return SendClientMessage(playerid,COLOR_RED,"You have not been issued a ticket");
    }
    else return SendClientMessage(playerid,COLOR_RED,"You are not a civilian");
    return 1;
}
As you can see there is no way of getting the closest police officer or medic. How would I do this? Thanks!


Re: Closest Player - [HiC]TheKiller - 06.01.2012

http://forum.sa-mp.com/showpost.php?...50&postcount=2

Also, the code in your signature has an error. It should be
pawn Код:
#define BanForHacks(%1)     (%1 * Years(1) * 32040)



Re: Closest Player - DarkKillerWithPride<3 - 06.01.2012

lmfao thanks bro