arrestKey in car
#6

Sorry dude dont work:S Is it not the problem of getclosestplayer look:
Код:
forward GetClosestPlayerToPlayer(playerid);
public GetClosestPlayerToPlayer(playerid)
{
    new Float:dist = 1000.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;
        GetPlayerPos(i,x2,y2,z2);
        GetVehiclePos(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
arrestKey in car - by Admigo - 12.05.2011, 15:32
Re: arrestKey in car - by SkizzoTrick - 12.05.2011, 15:47
Re: arrestKey in car - by Admigo - 12.05.2011, 18:34
Re: arrestKey in car - by Westiee - 12.05.2011, 21:30
Re: arrestKey in car - by Admigo - 12.05.2011, 21:43
Re: arrestKey in car - by Admigo - 12.05.2011, 21:57

Forum Jump:


Users browsing this thread: 1 Guest(s)