How to getobjectpos by model id?
#4

Quote:
Originally Posted by Y_Less
View Post
You can't. That's not a one-to-one relationship. If I create five telephone boxes then do:

pawn Code:
GetObjectModelPos(1216, x, y, z);
What should the return value be? There are five possible results, and no single way to determine which one to use.
sry i forget to think about that.

if in gamemode have worldobject(telephone) and it's on this coords.

world_object_telephone[1] = posx:123.1 posy:35.5 posz:22.1;
world_object_telephone[2] = posx:222.2 posy:10.0 posz: 15.5;
world_object_telephone[3] = posx:1422.2 posy:150.0 posz: 105.5;

can script make if player go near telephone, first check by objectid and get model from objectid
second if objectmodel(objectid) == telephone_model player can use this telephone
then if i have 3 telephone,coord of any telephone not duplicate because it's has different ObjectID.

that's my think(i'm lazy to save any phone coords in game.so sorry)

full my plan code
Code:
stock IsPlayerNearModelID(pid,modelid)
{
    new Float:x,Float:y,Float:z;
    for(new i=0;i<MAX_OBJECTS;i++)
    {
        if(GetObjectModel(i) == modelid)
        {
            GetObjectPos(i,x,y,z);
            if(PlayerToPoint(5.0,pid,x,y,z)
            {
                 //do something
                 break;
             }
        }
    } 
}
but it's no way to do this i cannot leave to save coords in game OMG!!!


ps.sorry for my bad english and my bad script
Reply


Messages In This Thread
How to getobjectpos by model id? - by basicllsw - 12.02.2015, 16:45
Re: How to getobjectpos by model id? - by Pottus - 12.02.2015, 16:59
Re: How to getobjectpos by model id? - by basicllsw - 13.02.2015, 02:39
Re: How to getobjectpos by model id? - by basicllsw - 13.02.2015, 10:48
Re: How to getobjectpos by model id? - by basicllsw - 13.02.2015, 11:22
Re: How to getobjectpos by model id? - by PowerPC603 - 13.02.2015, 11:23
Re: How to getobjectpos by model id? - by Threshold - 13.02.2015, 14:03
Re: How to getobjectpos by model id? - by basicllsw - 14.02.2015, 02:49
Re: How to getobjectpos by model id? - by Threshold - 14.02.2015, 04:00
Re: How to getobjectpos by model id? - by basicllsw - 14.02.2015, 06:16

Forum Jump:


Users browsing this thread: 1 Guest(s)