Need Help.
#1

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(IsPlayerAdmin(playerid))
	{
		if(success == 1)
        format(str, sizeof(str), "Player :(id:%d) Used This cmd %s.", name, playerid, cmdtext);
        SendClientMessage(playerid, 0x3DCCCAFF, str);
    }
    return 1;
}
Admin isn't receiving messages, just black messages come.I'm new so Help me please.
Reply
#2

lol that would be alot of spam for Administrator, you should define a function and use it insteed of SendClientMessage define a function sendadminmessage
Reply
#3

* Removed, wouldn't work.
Reply
#4

@Niko Hmm, can you give me an example.
Reply
#5

pawn Код:
forward SendAdminMessage(color, string[]);
pawn Код:
public SendAdminMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdmin] >= 1 || IsPlayerAdmin(i)) // rcon and admin r1+ change if you use another enum
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    printf("%s", string);
}
example how you use it:

pawn Код:
format(string, sizeof(string), "Your stuff", things for your stuff);
SendAdminMessage(YOUR_COLOR,string);
with this SendAdminMessage you won't need "if(IsPlayerAdmin(playerid))" under OnPlayerCommandPerformed
Reply
#6

@Niko bro showing me this error,

gamemodes\test.pwn(104) : error 017: undefined symbol "string"
gamemodes\test.pwn(115) : error 017: undefined symbol "PlayerInfo"
gamemodes\test.pwn(115) : warning 215: expression has no effect
gamemodes\test.pwn(115) : error 001: expected token: ";", but found "]"
gamemodes\test.pwn(115) : error 029: invalid expression, assumed zero
gamemodes\test.pwn(115) : fatal error 107: too many error messages on one line
Reply
#7

It's easy to fix you need to adjust it to your own script use ****** bro.
read errors why all is hard...
Reply
#8

I guess you don't have an enum for admin level, So I just deleted it from that code, try it
pawn Код:
forward SendAdminMessage(color, string[]);
public SendAdminMessage(color, string[])
{

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsPlayerAdmin(i))
        {
            SendClientMessage(i, color, string);
        }
    }
    printf("%s", string);
}
Reply
#9

@Niko & xVIP3Rx, Thank you so much brothers, it works.I appreciate you'r work brothers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)