get an object near the player + position of it not working...
#2

Are u sure that the cmd is getting called ?
cuz if it dosent show any message at all, then the command is not getting executed, try tracing the code to find whether the cmd is getting called or not
also this code will show "You ain't near any object" 1000 times if u are not near any object, this code is correct
pawn Код:
CMD:getobject(playerid, params[])
{
    new Float:px,Float:py,Float:pz,
    Float:ox,Float:oy,Float:oz,
    Float:orx, Float:ory, Float:orz;
    GetPlayerPos(playerid,px,py,pz);
    new bool:found = false;
    for(new o = 0; o < 1000; o++) // 1000 is the max object limit
    {
        GetObjectPos(o,ox,oy,oz);
        GetObjectRot(o, orx, ory, orz);
        if(IsPlayerNearObject(playerid, o, 3.0))
        {
            new string[128];
            format(string, sizeof(string), "Object id: %d, X: %f, Y: %f, Z: %f, Rx: %f, Ry: %f, Rz: %f", o, ox, oy, oz, orx, ory, orz);
            SendClientMessage(playerid, COLOR_ORANGE, string);
            print(string);
            SaveIn("ChatLog", string);
            found = true;
            break;
        }
    }
    if(!found) SendClientMessage(playerid, COLOR_RED, "You ain't near any object");
    return 1;
}
Also this code wont show the nearest object to the player, it'll simply show the first object in that range (by ID)
Reply


Messages In This Thread
get an object near the player + position of it not working... - by Apenmeeuw - 27.03.2013, 18:49
Re: get an object near the player + position of it not working... - by OrMisicL - 27.03.2013, 19:08
Re: get an object near the player + position of it not working... - by Apenmeeuw - 27.03.2013, 19:16
Re: get an object near the player + position of it not working... - by OrMisicL - 27.03.2013, 20:53
Re: get an object near the player + position of it not working... - by Apenmeeuw - 28.03.2013, 11:21

Forum Jump:


Users browsing this thread: 2 Guest(s)