Command. Distance showing.
#1

Hi all. I would like to know if is possible to do command which shows for player distance from object?

For example I have ocject:

Code:
  
new crateloc[30], string[128], rand = random(sizeof(g_CrateSpawns));

CrateObject = CreateDynamicObject(CRATE_MODEL_ID, g_CrateSpawns[rand][0], g_CrateSpawns[rand][1], g_CrateSpawns[rand][2]-0.4, -1, -1, -1); // Spawning the crate.
If it possible, how to do command for exaplme /whereobject and it will show for me distance from that object.
Reply
#2

HTML Code:
if(strcmp(cmdtext, "/distance", true) == 0)
    {
       new Float:X,Float:Y,Float:Z;
    GetObjectPos(CrateObject , X,Y,Z);
        new
        Float: fDistance = GetPlayerDistanceFromPoint(playerid, X,Y,Z),
        szMessage[44];
 
        format(szMessage, sizeof(szMessage), "You're %0.2f meters away from the vending machine.", fDistance);
        SendClientMessage(playerid, 0xA9C4E4FF, szMessage);
 
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)