OnPlayerText Problem
#6

Quote:
Originally Posted by doreto
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{

    if(AccountInfo[playerid][VIPlevel] == 1)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Bronze"Bronze "PURPLE"VIP]"Bronze" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;
    }
    if(AccountInfo[playerid][VIPlevel] == 2)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Silver"Silver "PURPLE"VIP]"Silver" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;

    }
    if(AccountInfo[playerid][VIPlevel] == 3)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Gold"Gold "PURPLE"VIP]"Gold" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;

    }
    return 0; // ignore the default text and send the custom one
}
Quote:
Originally Posted by TzAkS.
Посмотреть сообщение
You got somewhere in OnPlayerText something like this

Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s :  %s", sendername, text);
Is just an exemple..there you need to do something like this
Код:
if(AccountInfo[playerid][VIPlevel] == 0)
{
// codes
}
Becouse is called 2 times..
not work i will show all my OnPlayerText
pawn Код:
public OnPlayerText(playerid, text[])
{

    if(AccountInfo[playerid][VIPlevel] == 0)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Bronze"Bronze "PURPLE"VIP]"Bronze" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;
    }
    if(AccountInfo[playerid][VIPlevel] == 1)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Bronze"Bronze "PURPLE"VIP]"Bronze" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;
    }
    if(AccountInfo[playerid][VIPlevel] == 2)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Silver"Silver "PURPLE"VIP]"Silver" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;

    }
    if(AccountInfo[playerid][VIPlevel] == 3)
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}["Gold"Gold "PURPLE"VIP]"Gold" %s: %s", playername, text);
        SendPlayerMessageToAll(playerid, str);
        return 0;

    }
    if(text[0] == '!')
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}[TEAM CHAT]{00FF00} %s: %s", playername, text[1]);
        for(new i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid])
                SendClientMessage(i, COLOR_ORANGE, str);
        return 0;
    }
    if(text[0] == '/')
    {
        new str[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "{FFFFFF}[Commands]{00FF00} %s: %s", playername, text);
        for(new i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && AccountInfo[playerid][AdminLevel] >= 1)
                SendMessageToAdmins(COLOR_ORANGE, str);
        return 0;
    }
    if(Mute[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_BRIGHTRED,"You Cant Use The Chat You Have Been Muted");
        return 0;
    }
    return 0;
}
Reply


Messages In This Thread
OnPlayerText Problem - by [D]ry[D]esert - 15.05.2012, 13:02
Re: OnPlayerText Problem - by doreto - 15.05.2012, 13:05
Re: OnPlayerText Problem - by [D]ry[D]esert - 15.05.2012, 13:22
Re: OnPlayerText Problem - by doreto - 15.05.2012, 13:29
Re: OnPlayerText Problem - by TzAkS. - 15.05.2012, 13:30
Re: OnPlayerText Problem - by [D]ry[D]esert - 15.05.2012, 13:56
Re: OnPlayerText Problem - by Andi_Evandy - 15.05.2012, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)