Log Command addon
#1

Hello, i have this code under onplayercommand , and it works perfect , but i have a question , is there a way to add the players name with the ID in it to?

this is what i mean:

thecode:

Код:
	public OnPlayerCommandText(playerid, cmdtext[])
	{
	printf("DEBUG: OnPlayerCommandText(%d, %s)", playerid, cmdtext);
Out PUT: [22:37:03] DEBUG: OnPlayerCommandText(0, /ls)

is there a way to add with the player ID also the NAME of the player?
Reply
#2

what? Explain!
Reply
#3

ok , so with this code printf("DEBUG: OnPlayerCommandText(%d, %s)", playerid, cmdtext); , under onplayercommandtext , I GET ON CONSOL THIS: [22:37:03] DEBUG: OnPlayerCommandText(0, /ls) <--- Th ats the ID and command i did INGAME that logs into the console , i whant to make it so It LOGS the PLAYERS NAME INSTEAD OF players ID
Reply
#4

any one please help:S
Reply
#5

GetPlayerName()
Reply
#6

Quote:
Originally Posted by eldiablo1337
GetPlayerName()
Like this?

printf("DEBUG: OnPlayerCommandText(%d, %s)", GetPlayerName()playerid, cmdtext);
Reply
#7

lol.. uhm, look for the usage in wiki =]
Reply
#8

I did , is it to hard to give me code :S
Reply
#9

Uhh
pawn Код:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "DEBUG: OnPlayerCommandText(%s, %s) (ID:%d)", name, cmdtext, playerid);
printf(string);
// Untested.
Reply
#10

Don't need format, since that's what "printf" is.

pawn Код:
new string[128];
GetPlayerName(playerid,string,sizeof(string));
printf("DEBUG: OnPlayerCommandText(%s, %s) (ID:%d)",string,cmdtext,playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)