#1

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
Reply
#2

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;
}
Reply
#3

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);
Reply
#4

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);
    }
}
Reply
#5

Too many errors I am only using RCON admin! i thought there something mutch more simpler
Reply
#6

Код:
new string[124];
showing an error
Reply
#7

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 ?
Reply
#8

Код:
(1694) : warning 235: public function lacks forward declaration (symbol "OnPlayerCommandReceived")
line:

Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
Reply
#9

Do you have ZCMD included ?

I mean this:

pawn Код:
#include <zcmd>
Reply
#10

yes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)