Ranks before name in OnPlayerText don't work.
#1

Hello Again,
In my OnPlayerText, i try to add a rank before the name, but it just says:
Quote:

[MW]CaptainPrice[DF]: [MW]CaptainPrice[DF] Test

Here is my OnPlayerText (You just want the top part, not the VIP or Admin chat):
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    new year,month,day;
    new hour,minute,second;
    getdate(year,month,day);
    gettime(hour,minute,second);
   
    format(string, sizeof(string), "%s %s: %s", LvlName, pName, text); //Just this part
    SendPlayerMessageToAll(playerid, string); //And this part

    //Bot
    if(strfind(text,"noob bot",true) != -1)
    {
        SendClientMessageToAll(COLOR_GREEN, "[BOT]WarBot: I'm not the noob, you are.");
    }

    if(strfind(text,"hi bot",true) != -1)
    {
        SendClientMessageToAll(COLOR_GREEN, "[BOT]WarBot: Hey man!");
    }

    if(strfind(text,"ban the bot",true) != -1)
    {
        SendClientMessageToAll(COLOR_GREEN, "[BOT]WarBot: Why do you want me banned?");
    }

    //Admin Chat
    if(PlayerInfo[playerid][Admin] >= 1 && text[0] == '#')
    {
        format(string, sizeof(string),"(Admin Chat) %s(%d): %s", pName, playerid, text[1]);
        MessageToAdmins(COLOR_GREEN, string);
        format(string, sizeof(string),"[Date: %d/%d/%d][Time: %d:%d:%d] %s(%d): %s\n", year, month, day, hour, minute, second, pName, playerid, text[1]);
        SaveIn("AdminChat", string);
    }

    //VIP Chat
    if(PlayerInfo[playerid][Rank] >= 1 && text[0] == '^')
    {
        format(string, sizeof(string),"(VIP Chat) %s(%d): %s\n", pName, playerid, text[1]);
        MessageToVIPs(0x465300D7, string);
        format(string, sizeof(string),"[Date: %d/%d/%d][Time: %d:%d:%d] %s(%d): %s", year, month, day, hour, minute, second, pName, playerid, text[1]);
        SaveIn("VipChat", string);
    }
    return 0;
}
Any help?
Reply
#2

Can you show us where you define Lvlname? 0_o
Reply
#3

OK, here are my defines:
pawn Код:
enum pInfo
{
    Password,
    Cash,
    LoggedIn,
    Score,
    Admin,
    Operator,
    Rank,
    Xp,
    Protected,
    CapturingZone,
    Connects,
    Disconnects,
    LoginAttempts,
    Kills,
    Deaths,
    LastOn,
    RegisterDate,
    RegisterTime,
    Streak,
    PlayersInZone,
    CDP,
    Level //This one is the level number
}
Here is my LvlName:
pawn Код:
new LvlName[128];
It is at the top of my script, out of any publics.

Also, the ranks thing is here (It is more than 100 lines, so its pastebin):
http://pastebin.com/R1nE8u3p

And my forward for that is at the top of my script.
Reply
#4

Try changing

pawn Код:
LvLName[128];
to

pawn Код:
LvLName[MAX_PLAYERS][128];
Then on your public function change all the LvLName = "Whatever";

to

pawn Код:
LvLName[playerid] = "Whatever";
Then format under OnPlayerText like so:

pawn Код:
format(string, sizeof(string), "%s %s: %s", LvlName[playerid], pName, text);
Reply
#5

Still doesn't work.
Reply
#6

Is your OnPlayerXpIncrease function actually being called anywhere?
Reply
#7

Not yet, does it need to be?
Reply
#8

I would assume that it would need to be called so that it can format LvLName to be something. It's a bit odd that it shows the player name twice though..
Reply
#9

I created a stock, called the stock and STILL didn't work.
Reply
#10

Ah-ha! I believe I found the problem.

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    new year,month,day;
    new hour,minute,second;
    getdate(year,month,day);
    gettime(hour,minute,second);
   
    format(string, sizeof(string), "%s %s: %s", LvlName, pName, text);
    SendPlayerMessageToAll(playerid, string); //This should be SendClientMessageToAll, not SendPlayerMessageToAll
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)