What Wroung
#1

Guys Help plz i've add admin chat But I Don't Know why Vip chat work and Admin chat Don't
pawn Код:
forward MessageToPlayerAdmin(color,const string[]);
forward MessageToPlayerVIP(color,const string[]);
pawn Код:
//OnPlayerText
//==============================================================================
// Vip Chat
//==============================================================================
    if(text[0] == '!' && PlayerInfo[playerid][VIP] == 1)
    {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"[DONATOR] %s: %s",string,text[1]);
        MessageToPlayerVIP(green,string);
        return 0;
    }
//==============================================================================
// Administration Chat
//==============================================================================
    if(text[0] == '#' && PlayerInfo[playerid][Admin] == 1)
    {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"[ADMIN] %s: %s",string,text[1]);
        MessageToPlayerAdmin(grey,string);
        return 0;
    }
pawn Код:
public MessageToPlayerAdmin(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) == 1)
    if(PlayerInfo[i][Admin] >= 2)
    SendClientMessage(i, color, string);
    }
    return 1;
}

public MessageToPlayerVIP(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) == 1)
    if(PlayerInfo[i][VIP] >= 1)
    SendClientMessage(i, color, string);
    }
    return 1;
}
Reply
#2

pawn Код:
//OnPlayerText
//==============================================================================
// Vip Chat
//==============================================================================
    if(text[0] == '!' && PlayerInfo[playerid][VIP])
    {
        new string[128];
        GetPlayerName(playerid, string, sizeof(string));
        format(string, sizeof(string), "[DONATOR] %s: %s", string, text[1]);
        MessageToPlayerVIP(green, string);
        return 0;
    }
//==============================================================================
// Administration Chat
//==============================================================================
    if(text[0] == '#' && PlayerInfo[playerid][Admin])
    {
        new string[128];
        GetPlayerName(playerid,string,sizeof(string));
        format(string, sizeof(string), "[ADMIN] %s: %s", string, text[1]);
        MessageToPlayerAdmin(grey, string);
        return 0;
    }
You had 'PlayerInfo[playerid][Admin] == 1' and 'PlayerInfo[playerid][VIP] == 1', which means it only would have worked if you were a level 1 admin or level 1 VIP.

pawn Код:
public MessageToPlayerAdmin(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(PlayerInfo[i][Admin]) SendClientMessage(i, color, string);
    }
    return 1;
}

public MessageToPlayerVIP(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(PlayerInfo[i][VIP]) SendClientMessage(i, color, string);
    }
    return 1;
}
Reply
#3

You are making admins who are level 1+ can use # chat, while you don't show them be cause it's for level 2+ :
pawn Код:
public MessageToPlayerAdmin(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) == 1)
    if(PlayerInfo[i][Admin] >= 2) // Look here, level 2 only, while level 1 can send it but they don't see it.
    SendClientMessage(i, color, string);
    }
    return 1;
}
the fix is to change '2' to '1'.
Reply
#4

Guys im Admin lvl 5 and VIP Vip hat Work But Admin hat Don't work
Reply
#5

then do this:
pawn Код:
if(text[0] == '#' && PlayerInfo[playerid][Admin] >= 1)
     {
             new string[128];
             GetPlayerName(playerid,string,sizeof(string));
             format(string, sizeof(string), "[ADMIN] %s: %s", string, text[1]);
             MessageToPlayerAdmin(grey, string);
             return 0;
    }
    if(text[0] == '!' && PlayerInfo[playerid][VIP] >= 1) {
        new string[128];
        GetPlayerName(playerid, string, sizeof(string));
        format(string, sizeof(string), "[DONATOR] %s: %s", string, text[1]);
        MessageToPlayerVIP(green, string);
        return 0;
    }
Reply
#6

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
then do this:
pawn Код:
if(text[0] == '#' && PlayerInfo[playerid][Admin] >= 1)
     {
             new string[128];
             GetPlayerName(playerid,string,sizeof(string));
             format(string, sizeof(string), "[ADMIN] %s: %s", string, text[1]);
             MessageToPlayerAdmin(grey, string);
             return 0;
    }
    if(text[0] == '!' && PlayerInfo[playerid][VIP] >= 1) {
        new string[128];
        GetPlayerName(playerid, string, sizeof(string));
        format(string, sizeof(string), "[DONATOR] %s: %s", string, text[1]);
        MessageToPlayerVIP(green, string);
        return 0;
    }
Work Thanks: +rep
Reply
#7

Lol... did you even try my code...? -_-

wtf...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)