GetClosestPlayer returns always 0 ?
#1

Hi

I have this piece of code:

pawn Код:
dcmd_rob(playerid, params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][pTeam] == TEAM_COP) return SendClientMessage(playerid, COLOR_RED, "** Police officers cannot rob other people!");
    new otherplayer = GetClosestPlayer(playerid);
    if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_RED, "** No one close enough to rob!");
   
    SetPlayerCriminal(playerid, 2);
    new attempt = random(2);
    if(attempt == 1)
    {
        // If success, give money etc.
    }
    else
    {
      format(string, sizeof(string), "You attempted to rob some money from %s, but failed!", PlayerName(otherplayer));
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
}
GetClosestPlayer always seems to return 0 (when I tested I was playerid 0), even when I stand right next to another person.
Does anyone have a working GetClosestPlayer?

I copied my GetClosestPlayer function and the other functions it calls from the uf.inc into a new inc, because I can't include the whole uf.inc without getting a bunch of errors.
Reply


Messages In This Thread
GetClosestPlayer returns always 0 ? - by Vince - 28.02.2009, 16:21
Re: GetClosestPlayer returns always 0 ? - by Nubotron - 28.02.2009, 16:34
Re: GetClosestPlayer returns always 0 ? - by 1337pr0 - 01.03.2009, 02:19

Forum Jump:


Users browsing this thread: 1 Guest(s)