Getclosest issue
#1

Alright so the thing how it should work ,get closest player to you thats NOT part of your team
But preety much it doesnt work

pawn Код:
public GetClosestPlayerToPlayer(playerid)
{
    new Float:dist = 500.0;
    new targetid = INVALID_PLAYER_ID;
    new Float:x1,Float:y1,Float:z1;
    new Float:x2,Float:y2,Float:z2;
    new Float:tmpdis;
    GetPlayerPos(playerid,x1,y1,z1);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(i == playerid) continue;
        if(pInfo[i][Team] != pInfo[playerid][Team]) continue;
        if(GetVehicleModel(GetPlayerVehicleID(i) != 511) || GetVehicleModel(GetPlayerVehicleID(i) != 476)) continue;

        GetPlayerPos(i,x2,y2,z2);
        tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
        if(tmpdis < dist)
        {
            dist = tmpdis;
            targetid = i;
        }
    }
    return targetid;
}
Reply


Messages In This Thread
Getclosest issue - by TwinkiDaBoss - 01.08.2015, 14:27
AW: Getclosest issue - by Macronix - 01.08.2015, 14:45
Re: Getclosest issue - by Vince - 01.08.2015, 14:46
Re: Getclosest issue - by TwinkiDaBoss - 01.08.2015, 15:15
Re: Getclosest issue - by xVIP3Rx - 01.08.2015, 15:31
Re: Getclosest issue - by TwinkiDaBoss - 01.08.2015, 15:36
Re: Getclosest issue - by xVIP3Rx - 01.08.2015, 15:40
Re: Getclosest issue - by TwinkiDaBoss - 01.08.2015, 15:55
Re: Getclosest issue - by xVIP3Rx - 01.08.2015, 15:57
Re: Getclosest issue - by TwinkiDaBoss - 01.08.2015, 15:59

Forum Jump:


Users browsing this thread: 1 Guest(s)