players Commands
#1

How to see my players Commands.. even if it was wrong cmd like this /gdgdf
Reply
#2

pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( !success )
    {
        new
            msg_[ 64 ]
        ;
        format( msg_, sizeof( msg_ ), "The command \"%s\" does not exist", cmdtext );
        SendClientMessage( playerid, -1, msg_ );
    }
    return 1;
}
Reply
#3

If you are still using the outdated strcmp find the end of the OnPlayerCommandText callback and replace the return 0; with return SendClientMessage//store the command text in a string and return it in this message
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( !success )
    {
        new
            msg_[ 64 ]
        ;
        format( msg_, sizeof( msg_ ), "The command \"%s\" does not exist", cmdtext );
        SendClientMessage( playerid, -1, msg_ );
    }
    return 1;
}
thanks but i mean if im was admin.. i want see the players commands.. like if someone type /kill

i got message like "Player... has use cmd /kill"
Reply
#5

Oh, I misunderstood.

pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    new
        msg_[ 64 ],
        name_[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, name_, MAX_PLAYER_NAME );
    format( msg_, sizeof( msg_ ), "%s used: %s", name_, cmdtext );
    // SendMessageToAdmins or if you have any function to do that..
    // OR ELSE.. USE:
    for(new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( !IsPlayerConnected( i ) || pInfo[ i ][ pAdmin ] < 1 ) continue;
        // Change pInfo[ i ][ pAdmin ] to what you use for admins' levels
        SendClientMessage( i, 0xFFFF00FF, msg_ )
    }
    return 1;
}
Reply
#6

Here is code
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
       new playername[MAX_PLAYER_NAME];
       for(new i = 0; i < MAX_PLAYERS; i++)
      {
        if(IsPlayerAdmin(i))
        {
        GetPlayerName(playerid, playername, sizeof(playername));
	format(string, sizeof(string), "***%s (%d) typed: %s", playername,playerid,cmdtext);
	SendClientMessage(i, grey, string);
        }
      }
}
This is with RCON admin you can see cmds, but you can change it to whatever you want
Feel free to edit it
+Rep if it works
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( !success )
    {
        new
            msg_[ 64 ]
        ;
        format( msg_, sizeof( msg_ ), "The command \"%s\" does not exist", cmdtext );
        SendClientMessage( playerid, -1, msg_ );
    }
    return 1;
}
Thank you sir and sorry for ur time but i got this errors

Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    new
        msg_[ 64 ],
        name_[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, name_, MAX_PLAYER_NAME );
    format( msg_, sizeof( msg_ ), "%s used: %s", name_, cmdtext );
    // SendMessageToAdmins or if you have any function to do that..
    // OR ELSE.. USE:
    for(new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( !IsPlayerConnected( i ) || if( IsPlayerAdmin( i )) continue;
        // Change pInfo[ i ][ pAdmin ] to what you use for admins' levels
        SendClientMessage( i, 0xFFFF00FF, msg_ )
    }
    return 1;
}
Код:
C:\Users\John\Desktop\Server\gamemodes\FristGM.pwn(651) : error 029: invalid expression, assumed zero
C:\Users\John\Desktop\Server\gamemodes\FristGM.pwn(651) : error 001: expected token: ";", but found "continue"
C:\Users\John\Desktop\Server\gamemodes\FristGM.pwn(653) : warning 225: unreachable code
C:\Users\John\Desktop\Server\gamemodes\FristGM.pwn(654) : error 001: expected token: ";", but found "}"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#8

Quote:
Originally Posted by BoU3A
Посмотреть сообщение
Thank you sir and sorry for ur time but i got this errors

[code]public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
new
msg_[ 64 ],
name_[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, name_, MAX_PLAYER_NAME );
format( msg_, sizeof( msg_ ), "%s used: %s", name_, cmdtext );
// SendMessageToAdmins or if you have any function to do that..
// OR ELSE.. USE:
for(new i = 0; i < MAX_PLAYERS; i++ )
{
if( !IsPlayerConnected( i ) || if( IsPlayerAdmin( i )) continue;
// Change pInfo[ i ][ pAdmin ] to what you use for admins' levels
SendClientMessage( i, 0xFFFF00FF, msg_ )
}
return 1;
}
There is missing ";" here in this
Код:
SendClientMessage( i, 0xFFFF00FF, msg_ )
Just do this
Код:
SendClientMessage( i, 0xFFFF00FF, msg_ );
Reply
#9

pawn Код:
SendClientMessage( i, 0xFFFF00FF, msg_ );
Reply
#10

Except the missing semicolon (which was my mistake) the other is yours.

pawn Код:
if( !IsPlayerConnected( i ) || if( IsPlayerAdmin( i )) continue;
You cannot use another if before you close it. So you want to send the message to only RCON admins, right?

Change to:
pawn Код:
if( !IsPlayerConnected( i ) || !IsPlayerAdmin( i ) ) continue;
// If the player is not connected or not an RCON admin, skip it and go to the next player.
Also like the guys above said, add the semicolon!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)