Reading cmd admin
#1

Help fix. Admin report does not come, what a player uses cmd.

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(success)
    {
        format(str, sizeof(str), "Игрок %s(id:%d) использует команду %s.", name, playerid, cmdtext);
        SendMessageToAdmins(COLOR_GREY, str);
    }
    if(!success)
    {
        SendClientMessage(playerid, COLOR_GREEN, "Неверная команда. Используйте /cmd для просмотра списка команд.");
        format(str, sizeof(str), "Игрок %s(id:%d) использует команду %s.", name, playerid, cmdtext);
        SendMessageToAdmins(COLOR_GREY, str);
    }
    return 1;
}
stock SendMessageToAdmins(color,const msg[])
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
               if(!IsPlayerConnected(i))continue;
               if(PlayerInfo[i][pAdmin] == 0)continue;
               SendClientMessage(i,color,msg);
        }
        return 1;
}
Reply
#2

try changing the stock to
pawn Код:
stock SendMessageToAdmins(color,const msg[])
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
               if(IsPlayerConnected(i))
               {
                         if(PlayerInfo[i][pAdmin] > 0)
                         {
                                SendClientMessage(i,color,msg);
                                return 1;
                         }
                }
        }
        return 0;
}
Reply
#3

I think I found the problem!

Код:
stock SendMessageToAdmins(color,const msg[])
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
               if(!IsPlayerConnected(i))
               {
                      if(PlayerInfo[i][pAdmin] > 0)
                      {
                              SendClientMessage(i,color,msg);
                      }
               }
        }
        return 1;
}
I'm not shure that it will work, but try it!
Reply
#4

@adithegman it wont work
Your code is trying to send messag to offline players. this MIGHT cuz server to crash LAWL
Reply
#5

[HK]Ryder[AN], thank you very much.
Reply
#6

i m using it
but error

C:\Users\Mohamed\Desktop\Freeroam Holic International\gamemodes\NRG[V.4.0].pwn(38183) : error 021: symbol already defined: "OnPlayerCommandPerformed"
C:\Users\Mohamed\Desktop\Freeroam Holic International\gamemodes\NRG[V.4.0].pwn(38184) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Mohamed\Desktop\Freeroam Holic International\gamemodes\NRG[V.4.0].pwn(38185) : error 035: argument type mismatch (argument 2)
C:\Users\Mohamed\Desktop\Freeroam Holic International\gamemodes\NRG[V.4.0].pwn(38185) : error 035: argument type mismatch (argument 2)
C:\Users\Mohamed\Desktop\Freeroam Holic International\gamemodes\NRG[V.4.0].pwn(38184) : warning 204: symbol is assigned a value that is never used: "name"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#7

??
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)