14.11.2015, 19:15
Is it somehow possible to get the player's position, so like location instead of xyz?
PHP код:
CMD:getplayerpos(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] < 1) return 0;
if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_YELLOWGREEN, "Error: You are not authorized to use this command.");
new string[75], targetplayer, pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], Float:X, Float:Y, Float:Z;
if(sscanf(params, "u", targetplayer)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /getplayerpos [ID]");
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "Error: Player is not connected!");
GetPlayerPos(targetplayer, Float:X, Float:Y, Float:Z);
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(targetplayer, pName2, MAX_PLAYER_NAME);
format(string, sizeof string, "%s's position is 'X'%f 'Y'%f Z'%f'", pName2, Float:X, Float:Y, Float:Z);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
printf("[Getplayerpos] %s has used this command", pName);
return 1;
}