CMD - 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: CMD (
/showthread.php?tid=465508)
CMD -
lsreskjn - 22.09.2013
Hello, is there a simple way to see what players types? what commands? I am only using rcon admin so IsPlayerAdmin, i am looking for something very simple and i need to type it under my commands in my mod something like IfIsPlayerAdmin ...then...SendClientMessageToAdmin....Player xxx has used /xxx command...
I have printf("Player %s used command %s",Jmeno(playerid), cmdtext); to see in log what they typed
Re: CMD -
Areax - 22.09.2013
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
new string[150];
new name;
format(string, sizeof(string), "%s[ID:%d] Has Typed: %s", GetName(name), playerid, cmdtext);
SendAdminMessage(-1, string);
return 1;
}
pawn Код:
stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
pawn Код:
stock SendAdminMessage(color, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i) != 0)
SendClientMessage(i, color, string);
}
return 1;
}
Re: CMD -
Champ - 22.09.2013
You can use this stock
pawn Код:
stock SendClientMessageToAdmins(msg[]) for(new i; i < MAX_PLAYERS; i++) if(GetPlayerAdminLevel(i)) SendClientMessage(i, COLOR_SALMON, msg);
Replacing the Adminlevel variable to your own admin variable.
how to use it
see
pawn Код:
format(string, sizeof string, "=> Admin %s has ____ %s.", pName, gName);
SendClientMessageToAdmins(string);
Re: CMD -
EiresJason - 22.09.2013
Put this where the printf is.
pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerAdmin(i)) //or replace with your admin variable such as if(PlayerInfo[i][pAdmin] >= 1)
{
new string[128];
format(string,sizeof(string),"Player %s has used the command %s",Jmeno(playerid),cmdtext);
SendClientMessage(i,-1,string);
}
}
Re: CMD -
lsreskjn - 22.09.2013
Too many errors

I am only using RCON admin! i thought there something mutch more simpler
Re: CMD -
lsreskjn - 22.09.2013
showing an error
Re: CMD -
Areax - 22.09.2013
Quote:
Originally Posted by Areax
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[]) { new string[150]; new name; format(string, sizeof(string), "%s[ID:%d] Has Typed: %s", GetName(name), playerid, cmdtext); SendAdminMessage(-1, string); return 1; }
pawn Код:
stock GetName(playerid) { new name[24]; GetPlayerName(playerid, name, sizeof(name)); return name; }
pawn Код:
stock SendAdminMessage(color, const string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerAdmin(i) != 0) SendClientMessage(i, color, string); } return 1; }
|
What ERRORS you get ?
Re: CMD -
lsreskjn - 22.09.2013
Код:
(1694) : warning 235: public function lacks forward declaration (symbol "OnPlayerCommandReceived")
line:
Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
Re: CMD -
Areax - 22.09.2013
Do you have ZCMD included ?
I mean this:
Re: CMD -
lsreskjn - 22.09.2013
yes