SA-MP Forums Archive
Show Coords Command Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Show Coords Command Help (/showthread.php?tid=448657)



Show Coords Command Help - Aerotactics - 05.07.2013

Simply stated, I just want to use this command in-game to tell me my coords, but I'm not sure how to display the coords exactly:

pawn Код:
if(strcmp(cmdtext,"/GPS",true) == 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid,X,Y,Z);
        SendClientMessage(playerid, 0xFFEE00, "You are at X Y Z.");
        return 1;
    }
I saw the script somewhere on a ****** search and couldn't find it again. It would be useful for my mapping.


Re: Show Coords Command Help - magnusburton - 05.07.2013

You can use the function format() to format a string and display it together with variables.

pawn Код:
new string[64];
format(string, sizeof(string), "You are at %0.f %0.f %0.f.", X, Y, Z);
SendClientMessage(playerid, 0xFFEE00, string);



Re: Show Coords Command Help - Aerotactics - 05.07.2013

Quote:
Originally Posted by magnusburton
Посмотреть сообщение
You can use the function format() to format a string and display it together with variables

pawn Код:
new string[64];
format(string, sizeof(string), "You are at %0.f %0.f %0.f.", X, Y, Z);
SendClientMessage(playerid, COLOR_WHITE, string);
Testing.

EDIT: Problem solved! Thank you sir for your help.


Re: Show Coords Command Help - M3HR4N - 05.07.2013

if that doesn't work, try using this :
Код:
if(strcmp(cmdtext,"/GPS",true) == 0)
    {
        new Float:X, Float:Y, Float:Z;
        new string[64];
        GetPlayerPos(playerid,X,Y,Z);
        format(string, sizeof(string), "You are at %f %f %f.", X, Y, Z);
        SendClientMessage(playerid, 0xFFEE00, string);
        return 1;
    }