MessageToAdmins and VIP bug
#1

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
Reply
#2

What is the issue? What happens when the function is called?
Reply
#3

Nothink Happen
Reply
#4

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

What you Mean
Reply
#6

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

Don't Work
Reply
#8

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
Reply
#9

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

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)