Log All Commands. - 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: Log All Commands. (
/showthread.php?tid=617730)
Log All Commands. -
CannonBolt - 25.09.2016
Is there a way to send admin a message with any/every command a player types?
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
new string[120];
format(string,sizeof(string),"%s(%d) Typed %s",PlayerName,playerid,cmdtext);
SendAdminMessage(-1);
return 1;
}
is this correct?
Re: Log All Commands. -
Shinja - 25.09.2016
Yes it is
Re: Log All Commands. -
Threshold - 26.09.2016
Well you have the right idea, yes. But you're not actually sending 'string' through the SendAdminMessage function. Do you want it to show for invalid commands too? What if someone spams "/givemefreemoney"? The text will spam even when the command doesn't exist.
I suggest you make use of the 'success' parameter in the callback.
Re: Log All Commands. -
CannonBolt - 26.09.2016
Quote:
Originally Posted by Threshold
Well you have the right idea, yes. But you're not actually sending 'string' through the SendAdminMessage function. Do you want it to show for invalid commands too? What if someone spams "/givemefreemoney"? The text will spam even when the command doesn't exist.
I suggest you make use of the 'success' parameter in the callback.
|
Hmm,this is sooo true I forgot about this but there's Cleo hacks that get activated with /aimbot for example that won't give a success result as it won't exist in the script guess this is the only way?
Re: Log All Commands. -
Threshold - 26.09.2016
Well if OnPlayerCommandText is being NOP'd when they type it, then there really isn't anything you can do with the current state SA-MP is in. I think you'd be better off alerting admins when they type certain commands rather than typing 'any' command.
Example:
PHP код:
if(!strcmp(cmdtext, "/aimbot", true, 7))
Re: Log All Commands. -
jlalt - 26.09.2016
Quote:
Originally Posted by Threshold
Well if OnPlayerCommandText is being NOP'd when they type it, then there really isn't anything you can do with the current state SA-MP is in. I think you'd be better off alerting admins when they type certain commands rather than typing 'any' command.
Example:
PHP код:
if(!strcmp(cmdtext, "/aimbot", true, 7))
|
if a command is client sided, for ex this /aimbot the OnPlayerCommandText callback won't be called.
Re: Log All Commands. -
Threshold - 26.09.2016
Quote:
Originally Posted by jlalt
if a command is client sided, for ex this /aimbot the OnPlayerCommandText callback won't be called.
|
I know that... I literally just said that.