SA-MP Forums Archive
Need Help. - 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: Need Help. (/showthread.php?tid=479588)



Need Help. - Player23 - 05.12.2013

Код:
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.


Re: Need Help. - ***Niko*** - 05.12.2013

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


Re: Need Help. - TLN - 05.12.2013

* Removed, wouldn't work.


Re: Need Help. - Player23 - 05.12.2013

@Niko Hmm, can you give me an example.


Re: Need Help. - ***Niko*** - 05.12.2013

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


Re: Need Help. - Player23 - 05.12.2013

@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


Re: Need Help. - ***Niko*** - 05.12.2013

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


Re: Need Help. - xVIP3Rx - 05.12.2013

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);
}



Re: Need Help. - Player23 - 06.12.2013

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