SA-MP Forums Archive
Find a position - 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: Find a position (/showthread.php?tid=305216)



Find a position - SrazZz - 21.12.2011

Hello,

First, excuse me for my bad English.

I'm new in the field of scripting, and I know a question that seems silly, it's "how to get the coordinates x, y, z" of a place?

Thank you in advance,


Re: Find a position - Tee - 21.12.2011

Go there and type /save then go to:

MyDocuments > GTA San Andreas User Files > SAMP > savedpostions.txt


Re: Find a position - skaTim - 21.12.2011

Better way to find out the coords.

Код:
if(strcmp(cmdtext, "/coords", true)==0)
{
    new Float:mx,Float:my,Float:mz;
    GetPlayerPos(playerid,mx,my,mz);
    new stringa[MAX_STRING];
    format(stringa,sizeof(stringa),"X:%f Y:%f Z:%f | Int: %d | VW: %d",mx,my,mz,GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
    SendClientMessage(playerid,COLOR_WHITE,stringa);
    return 1;
 }
ZCMD:

Код:
COMMAND:coords(playerid, params[])
{
	new Float:_ps[3];
	GetPlayerPos(playerid, _ps[0], _ps[1], _ps[2]);
	SendClientMSG(playerid, COLOR_LIGHTGREY, "[DEBUG]: %f,%f,%f | Int: %d | VW: %d",_ps[0], _ps[1], _ps[2], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
	return 1;
}



Re : Find a position - SrazZz - 21.12.2011

thanks


Re : Find a position - SrazZz - 22.12.2011

In
Код:
AddPlayerClass(12,1062.3319,2079.3210,10.8203,191.4850,0,0,0,0,0,0); //
What is the positions ?

Thanks.


Re: Find a position - Ballu Miaa - 22.12.2011

Sorry for strcmp! you can change it according to your needs if you want ZCMD and sscanf2 used!
pawn Код:
if(strcmp(cmd, "/addpos", true) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
            new Float:X,Float:Y,Float:Z,Float:A,File:pos;
            GetPlayerPos(playerid,X,Y,Z);
            GetPlayerFacingAngle(playerid,A);
            pos = fopen("footpos's.txt", io_append);
            format(string, 256, "ON Foot Pos == %f, %f, %f, %f\n", X, Y, Z, A);
            fwrite(pos, string);
            fclose(pos);
            format(string, sizeof(string), "Location Saved in the file by : %f, %f, %f", X,Y,Z);
            SendClientMessage(playerid, COLOR_GREEN, string);
            return 1;
         }
    }
1. Use this to get the position of the coordinates and they get saved in a file called "footpos.txt"
2. XYZ in AddPlayerClass is the default spawn point for that skin which you choose! You dont need any other function after that but yes! For teams we do make other functions like i have SpawnPlayer(playerid) i use it over OnPlayerSpawn() callback.


Re: Re : Find a position - Eric - 22.12.2011

Quote:
Originally Posted by SrazZz
Посмотреть сообщение
In
Код:
AddPlayerClass(12,1062.3319,2079.3210,10.8203,191.4850,0,0,0,0,0,0); //
What is the positions ?

Thanks.
AddPlayerClass(12,1062.3319,2079.3210,10.8203,191.4850,0,0,0,0,0,0); //

I bolded the XYZ positions. Those are the ones you'll need to pay attention to.
The 191.4850 afterwards is the angle.