Problem With /rob Command [+REP]
#3

Well,i tried that while i was near a player and kept saying: You cannot rob yourself.

EDIT: GetClosestPlayerToPlayer Function Code and there is a Forward for it:
pawn Код:
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);
        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
Problem With /rob Command [+REP] - by Youssef214 - 22.06.2014, 09:52
Re : Problem With /rob Command [+REP] - by S4t3K - 22.06.2014, 09:56
Re: Problem With /rob Command [+REP] - by Youssef214 - 22.06.2014, 09:58
Re : Problem With /rob Command [+REP] - by S4t3K - 22.06.2014, 10:00
Re: Problem With /rob Command [+REP] - by Youssef214 - 22.06.2014, 10:02
Re : Problem With /rob Command [+REP] - by S4t3K - 22.06.2014, 10:06
Re: Problem With /rob Command [+REP] - by Youssef214 - 22.06.2014, 10:08
Re : Problem With /rob Command [+REP] - by S4t3K - 22.06.2014, 10:13
Re: Problem With /rob Command [+REP] - by Youssef214 - 22.06.2014, 10:21
Re : Problem With /rob Command [+REP] - by S4t3K - 22.06.2014, 10:23

Forum Jump:


Users browsing this thread: 1 Guest(s)