Requesting help with this function.
#1

I'm very sorry, if there are errors in the code, I'm just learning.
I hope you can help me.

Without further ado, What I want to do with this function is get the level of some player and it will be printed as the name defined.

Whether a player is level 0, it shall be printed "Newbie".
Whether a player is level 1, it shall be printed "Operator".

PHP код:
stock GetLevel(playerid)
{
        new 
level[21];
    if(
PlayerInfo[playerid][pAdmin] == 0)
    {
    
level "Newbie";
    }
    if(
PlayerInfo[playerid][pAdmin] == 1)
    {
    
level "Operator";
    }
    if(
PlayerInfo[playerid][pAdmin] == 2)
    {
    
level "Moderator";
    }
    if(
PlayerInfo[playerid][pAdmin] == 3)
    {
    
level "Junior Administrator";
    }
    if(
PlayerInfo[playerid][pAdmin] == 4)
    {
    
level  "Senior Administrator";
    }
    if(
PlayerInfo[playerid][pAdmin] == 5)
    {
    
level  "Head Administrator";
    }
    if(
PlayerInfo[playerid][pAdmin] == 6)
    {
    
level "Hero Administrator";
    }
    if(
PlayerInfo[playerid][pAdmin] == 7)
    {
    
level "Community Owner";
    }
    return 
1;

I tried to see what the console prints. And this is what appears.
Код:
[14:07:11] Player Drake, Level: @Drake has joined in the server
That's what I have under "OnPlayerConnect":

Код:
printf("Player %s, Level: %s has joined in the server", Name(playerid), GetLevel(playerid));
The help will be appreciated.
Reply
#2

Instead of returning 1 you should return the level.

return 1; ----> return level;
Reply
#3

Thanks for the immediate response. I will try now.
Reply
#4

I would say that seems right but use this when connecting

Well first your ranks have to be added to all the things even under the gamemode.pwn, so try to add all the ranks to the gamemode.pwn, where all the factions and stuff are scripted

Hope I helped!
Reply
#5

It worked, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)