SA-MP Forums Archive
What Wroung - 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: What Wroung (/showthread.php?tid=557540)



What Wroung - AYOUYOU - 14.01.2015

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



Re: What Wroung - Threshold - 14.01.2015

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



Re: What Wroung - Sawalha - 14.01.2015

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'.


Re : What Wroung - AYOUYOU - 14.01.2015

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



Re: What Wroung - Sawalha - 14.01.2015

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



Re : Re: What Wroung - AYOUYOU - 14.01.2015

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


Re: What Wroung - Threshold - 14.01.2015

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

wtf...