SA-MP Forums Archive
Log Command addon - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Log Command addon (/showthread.php?tid=92022)



Log Command addon - XeoN_13 - 18.08.2009

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?


Re: Log Command addon - Eazy_Efolife - 18.08.2009

what? Explain!


Re: Log Command addon - XeoN_13 - 18.08.2009

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


Re: Log Command addon - XeoN_13 - 18.08.2009

any one please help:S


Re: Log Command addon - eldiablo1337 - 18.08.2009

GetPlayerName()


Re: Log Command addon - XeoN_13 - 18.08.2009

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

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


Re: Log Command addon - eldiablo1337 - 18.08.2009

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


Re: Log Command addon - XeoN_13 - 18.08.2009

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


Re: Log Command addon - Abernethy - 18.08.2009

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.



Re: Log Command addon - Joe Staff - 18.08.2009

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);