SA-MP Forums Archive
zyx location - 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: zyx location (/showthread.php?tid=594203)



zyx location - saffierr - 14.11.2015

Is it somehow possible to get the player's position, so like location instead of xyz?
PHP код:
CMD:getplayerpos(playeridparams[])
{
    if(
PlayerInfo[playerid][AdminLevel] < 1) return 0;
    if(
PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playeridCOLOR_YELLOWGREEN"Error: You are not authorized to use this command.");
    new 
string[75], targetplayerpName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], Float:XFloat:YFloat:Z;
    if(
sscanf(params"u"targetplayer)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /getplayerpos [ID]");
    if(!
IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected!");
    
GetPlayerPos(targetplayerFloat:XFloat:YFloat:Z);
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
GetPlayerName(targetplayerpName2MAX_PLAYER_NAME);
    
format(stringsizeof string"%s's position is 'X'%f 'Y'%f Z'%f'"pName2Float:XFloat:YFloat:Z);
    
SendClientMessage(playeridCOLOR_LIGHTGREENstring);
    
printf("[Getplayerpos] %s has used this command"pName);
    return 
1;




Re: zyx location - lucamsx - 14.11.2015

You mean, something like "Los Santos" or "Idlewood"?


Re: zyx location - saffierr - 14.11.2015

Exactly


Re: zyx location - lucamsx - 14.11.2015

you have to create these zones first, then give a name to every single one, make a function that gets players position and checks in which zone player is.
check out this thing: https://sampforum.blast.hk/showthread.php?tid=147

edit: or use this include, i'm using it myself and it's pretty nice
http://www81.zippyshare.com/v/pJsARB7A/file.html