/am problem
#3

Try this:

Add this on top if you don't have isnull stock:
PHP код:
#if !defined isnull
    #define isnull(%1) \
                
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif 
Command:
PHP код:
CMD:am(playeridparams[])
{
    new 
toidmessage[80];
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /am [id/name] [message] or /am [message]");
    if(
sscanf(params"us[80]"toidmessage
    {
        if(
sscanf(params"s[80]"message)) return SendClientMessageEx(playeridCOLOR_WHITE,"USAGE: /am [message]");
        if(
strlen(message) > 80) return SendClientMessageEx(playeridCOLOR_RED,"Your message cannot be longer than 80 characters.");
        new 
string[128];
        for(new 
i=0i<MAX_PLAYERSi++)
        {
            if(
PlayerInfo[i][pAdmin] >= 1)
            {
                
format(stringsizeof(string), "Admin message from %s [%d]: %s"GetPlayerNameEx(playerid), playeridmessage);
                
SendClientMessageEx(i,COLOR_GREEN,string);
                
AMReplyId[i] = playerid;
            }
        }
        
format(stringsizeof(string), "Your message, %s, has been sent."message);
        
SendClientMessageEx(playeridCOLOR_GREENstring);
        
format(stringsizeof(string), "Player %s [%d] > Admins: %s"GetPlayerNameEx(playerid), playeridmessage);
    }
    else
    {
        if(
strlen(message) > 80) return SendClientMessageEx(playeridCOLOR_RED,"Your message cannot be longer than 80 characters.");
        if(!
IsPlayerConnected(toid)) return SendClientMessageEx(playeridCOLOR_RED,"That player is not connected!");
        new 
string[128];
        
format(stringsizeof(string), "Admin message from %s: %s"GetPlayerNameEx(playerid), message);
        
SendClientMessageEx(AMReplyId[playerid], COLOR_GREENstring);
        for(new 
i=0i<MAX_PLAYERSi++)
        {
            if(
PlayerInfo[i][pAdmin] >= 1)
            {
                
format(stringsizeof(string), "Admin %s [%d] > %s [%d]: %s"GetPlayerNameEx(playerid), playeridGetPlayerNameEx(toid), toidmessage);
                
SendClientMessageEx(i,COLOR_GREEN,string);
            }
        }
    }
    return 
1;

Reply


Messages In This Thread
/am problem - by Ghost110 - 31.01.2015, 03:52
Re: /am problem - by Rabea - 31.01.2015, 07:54
Re: /am problem - by ATGOggy - 31.01.2015, 08:14
Re: /am problem - by Ghost110 - 01.02.2015, 02:45
Re: /am problem - by Primard - 01.02.2015, 02:50
Re: /am problem - by lwilson - 01.02.2015, 04:29
Re: /am problem - by ATGOggy - 01.02.2015, 06:55
Re: /am problem - by CalvinC - 01.02.2015, 09:10

Forum Jump:


Users browsing this thread: 1 Guest(s)