OnPlayerText Problem
#1

Hi every one
i tried to make if player talk or text anything and he is VIP it Show like That [Gold VIP][D]ry[D]esert:Whats Problem in that ?
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;

    }
}
Reply
#2

and what is the problem ?
Reply
#3

lol my bad i mean it show like this
D]ry[D]esert:[Gold VIP][[D]ry[D]esertWhats Problem in that ?
Reply
#4

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

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

try to change:
pawn Код:
SendPlayerMessageToAll(playerid, str);
to
pawn Код:
for(new i;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) SendClientMessage(i, -1, str);
or
pawn Код:
SendClientMessageToAll(-1, str);
hope it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)