PDA

View Full Version : Help: Playerinfo


Areax
01/04/2013, 04:51 PM
Hello!

I need your help...

How can I make a command /playerinfo [player ID] like this...

Playerinfo: Name: Myname (ID:7), IP: ip of a player, Location: his location

Thanks for your help and time :)

Isolated
01/04/2013, 04:59 PM
new String[128], Playername[MAX_PLAYER_NAME], IP[16];
GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
GetPlayerIp(playerid, IP, MAX_PLAYER_NAME);
format(String, sizeof(String), "PlayerInfo: Name: %s(%d), IP: %s", Playername, IP);
SendClientMessage(playerid, -1, String);
return 1;

Areax
01/04/2013, 05:03 PM
new String[128], Playername[MAX_PLAYER_NAME], IP[16];
GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
GetPlayerIp(playerid, IP, MAX_PLAYER_NAME);
format(String, sizeof(String), "PlayerInfo: Name: %s(%d), IP: %s", Playername, IP);
SendClientMessage(playerid, -1, String);
return 1;


Thanks for this REP+, what about location?

Isolated
01/04/2013, 05:04 PM
I recommend you look into the Zones include. Otherwise the location would just show as a bunch of numbers, I can add the location in if you'd like?

Areax
01/04/2013, 05:05 PM
I recommend you look into the Zones include. Otherwise the location would just show as a bunch of numbers, I can add the location in if you'd like?

Sure

Isolated
01/04/2013, 05:11 PM
new String[128], Playername[MAX_PLAYER_NAME], IP[16], Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
GetPlayerIp(playerid, IP, MAX_PLAYER_NAME);
GetPlayer
format(String, sizeof(String), "PlayerInfo: Name: %s(%d), IP: %s, Location: X: %d Y:%d Z:%d", Playername, IP, X, Y, Z);
SendClientMessage(playerid, -1, String);
return 1

As I said, it'll only show the X Y and Z as float numbers.

EDIT: If you use ZCMD I will happily type this command up fully including the SSCANF && Zones and everything.