SA-MP Forums Archive
Admin chat - 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: Admin chat (/showthread.php?tid=351701)



Admin chat - Nicholas. - 17.06.2012

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?


Re: Admin chat - WagnerPM - 17.06.2012

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



Re: Admin chat - Nicholas. - 17.06.2012

Didn't work.


Re: Admin chat - misho1 - 17.06.2012

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



Re: Admin chat - Nicholas. - 17.06.2012

Same problem.


Re: Admin chat - WagnerPM - 17.06.2012

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



Re: Admin chat - .FuneraL. - 17.06.2012

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.


Re: Admin chat - Nicholas. - 17.06.2012

Thank you, it worked.


Re: Admin chat - misho1 - 17.06.2012

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


Re: Admin chat - Nicholas. - 17.06.2012

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

Rep'ed all of you.