Admin chat
#1

This is a admin chat command I coded into my script a few hours ago but I've a slight problem with it. My problem is; If I use the command without typing a text and leave it bank, It won't show sendclientmessage. It usual shows up like this, [Owner] [0]Nicholas: *Blank*

pawn Код:
CMD:achat(playerid, params[])
{
    new PlayerName[128], String[128];
    if(PlayerInfo[playerid][Admin] < 1)
    if(sscanf (params, "s[128]")) return SendClientMessage(playerid, -1, ""COL_DARKRED"[ADMIN:]"COL_WHITE" Try using"COL_DARKRED" /achat"COL_WHITE" to speak with other admins.");
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(String, sizeof(String),""COL_DARKRED"[%s]"COL_LIGHTBLUE" [%d] %s:"COL_DARKRED" %s", GetAdminLevel(playerid), playerid, PlayerName, params);
    SendAdminMessage(-1, String);
    Logs(String, 2);
    return 1;
}
How can I fix this?
Reply
#2

pawn Код:
CMD:achat(playerid, params[])
{
    new PlayerName[128], String[128], Texto[128];
    if(PlayerInfo[playerid][Admin] < 1)
    if(sscanf (params, "s[128]", Texto)) return SendClientMessage(playerid, -1, ""COL_DARKRED"[ADMIN:]"COL_WHITE" Try using"COL_DARKRED" /achat"COL_WHITE" to speak with other admins.");
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(String, sizeof(String),""COL_DARKRED"[%s]"COL_LIGHTBLUE" [%d] %s:"COL_DARKRED" %s", GetAdminLevel(playerid), playerid, PlayerName, params);
    SendAdminMessage(-1, String);
    Logs(String, 2);
    return 1;
}
Reply
#3

Didn't work.
Reply
#4

Try My Cmd
pawn Код:
CMD:achat(playerid, params[])
            {
            new Text[128];
            new string[140];
            new n[MAX_PLAYER_NAME];
            GetPlayerName(playerid,n,sizeof(n));
            if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,0xFF8000C8,"You need to be level 3 to use this command!");
            if(sscanf(params,"s[128]",Text)) return SendClientMessage(playerid,0xFF0000C8,"USAGE:/Say [Text]");
            format(string,sizeof(string),"{FF0000}[Admin:%s]:{00FF00}%s",n,Text);
            SendClientMessageToAll(0xFF8000C8, string);
            return 1;
    }
Reply
#5

Same problem.
Reply
#6

I do not know if it will work. Still tries:

pawn Код:
CMD:achat(playerid, params[])
CMD:achat(playerid, params[])
{
    new PlayerName[128], String[128], Texto[128];
    if(PlayerInfo[playerid][Admin] < 1)
    if(sscanf (params, "s" Texto)) return SendClientMessage(playerid, -1, ""COL_DARKRED"[ADMIN:]"COL_WHITE" Try using"COL_DARKRED" /achat"COL_WHITE" to speak with other admins.");
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(String, sizeof(String),""COL_DARKRED"[%s]"COL_LIGHTBLUE" [%d] %s:"COL_DARKRED" %s", GetAdminLevel(playerid), playerid, PlayerName, Texto);
    SendAdminMessage(-1, String);
    Logs(String, 2);
    return 1;
}
Reply
#7

Quote:
Originally Posted by Nicholas.
Посмотреть сообщение
Same problem.
pawn Код:
CMD:achat(playerid, params[])
{
     new AdmName[24], String[128], Text[128];
     if(PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playerid, -1, "You Not Administrator");
     if(sscanf(params, "s[128]", Text)) return SendClientMessage(playerid, -1, "Using: /achat [Text]");
     GetPlayerName(playerid, AdmName, sizeof(AdmName));
     format(String, sizeof(String), "Admin-Chat: %s: %s", AdmName, Text);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
          if(PlayerInfo[i][Admin] > 1)
          {
               SendClientMessage(i, -1, String);
          }
      }
     return 1;
}
Try This.
Reply
#8

Thank you, it worked.
Reply
#9

Quote:
Originally Posted by Nicholas.
Посмотреть сообщение
Same problem.
It Works Fine With Me
Reply
#10

No bud. Yours didn't worked but thanks anyways.

Rep'ed all of you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)