SA-MP Forums Archive
MessageToAdmins and VIP bug - 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: MessageToAdmins and VIP bug (/showthread.php?tid=547927)



MessageToAdmins and VIP bug - AYOUYOU - 26.11.2014

I have problйm in MessageToAdmins and MessageToPlayerVIP

pawn Код:
public OnPlayerText(playerid, text[])
 if(text[0] == '*' && P_Data[playerid][VIP] >= 1)
    {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"VIP Chat: %s: %s",string,text[1]);
        MessageToPlayerVIP(0xDC686BAA,string);
        return 0;
    }
//==============================================================================
// Administration Chat
//==============================================================================
    else if(text[0] == '#' && P_Data[playerid][pAdmin] >= 1)
    {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]);
        MessageToAdmins(COLOR_GREEN,string);
        return 0;
    }
   return 1;
}
forward MessageToAdmins(color,const string[]);
forward MessageToPlayerVIP(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1)
        if(P_Data[i][pAdmin] >= 1)
        SendClientMessage(i, color, string);
    }
    return 1;
}
stock SendCommandToAdmins(playerid,command[])
{
    new string[128];
    GetPlayerName(playerid,string,sizeof(string));
    format(string,sizeof(string),"'%s' (Level: %d) | Command: %s",string,P_Data[playerid][pAdmin],command);
    return MessageToAdmins(COLOR_BLUE,string);
}

public MessageToPlayerVIP(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1)
        if(P_Data[i][VIP] >= 1)
        SendClientMessage(i, color, string);
    }
    return 1;
}
Hope help me


Re: MessageToAdmins and VIP bug - Jonesy96 - 26.11.2014

What is the issue? What happens when the function is called?


Re : MessageToAdmins and VIP bug - AYOUYOU - 26.11.2014

Nothink Happen



Re: MessageToAdmins and VIP bug - sammp - 26.11.2014

for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(P_Data[i][AdminLevel] >= 1 && i != INVALID_PLAYER_ID)
{
SendClientMessage(i, color, string);
}
}


Re : MessageToAdmins and VIP bug - AYOUYOU - 26.11.2014

What you Mean


Re: MessageToAdmins and VIP bug - JuanStone - 26.11.2014

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <foreach>

#define COLOR_GREEN 0xFFFFFFF

enum something
{
    pAdmin,
    VIP
};

new P_Data[MAX_PLAYERS][something];

public OnPlayerText(playerid, text[])
{
    new i_chat_tex[144];
    if(text[0] == '#' && P_Data[playerid][pAdmin] >= 1)
    {
        format(i_chat_tex,sizeof(i_chat_tex),"Admin Chat: %s: %s", Name(playerid), text[1]); // First va chat admin
        MessageToAdmins(COLOR_GREEN, i_chat_tex);
        return false;
    }
    if(text[0] == '*' && P_Data[playerid][VIP] >= 1)
    {
        format(i_chat_tex, sizeof(i_chat_tex), "VIP Chat: %s: %s", Name(playerid), text[1]); // After you are vip chat
        MessageToPlayerVIP(0xDC686BAA, i_chat_tex);
        return false;
    }
    if(IsPlayerConnected(playerid))
    {
        format(i_chat_tex, sizeof(i_chat_tex), "%s: %s", Name(playerid), text); // Finally the chat by default
        SendClientMessageToAll(-1, i_chat_tex);
        return false;
    }
    return true;
}

stock MessageToPlayerVIP(color, const string[])
{
    foreach(Player, i)
    {
        if(IsPlayerConnected(i))
        {
            if(P_Data[i][VIP] >= 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return true;
}

stock MessageToAdmins(color, const string[])
{
    foreach(Player, i)
    {
        if(IsPlayerConnected(i))
        {
            if(P_Data[i][pAdmin] >= 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return true;
}

stock Name(playerid)
{
    new i_name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, i_name, MAX_PLAYER_NAME);
    return i_name;
}



Re : MessageToAdmins and VIP bug - AYOUYOU - 26.11.2014

Don't Work


Re: MessageToAdmins and VIP bug - amirab - 26.11.2014

try to debug OnPlayerText
i'm sure the problem is in that
because your functions work perfectly
try to debug to see does it even send anything to server or not


Re: MessageToAdmins and VIP bug - AnthonyTimmers - 26.11.2014

What exactly are you trying to achieve, and what is happening?


Re: MessageToAdmins and VIP bug - AnthonyTimmers - 26.11.2014

Try this:

Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '*' && P_Data[playerid][VIP] >= 1)
        print("VIP test");
    else if(text[0] == '#' && P_Data[playerid][pAdmin] >= 1)
        print("Admin test");
    return 1;
}
And see if anything comes up in your console (just to see if the methods are even being called)