How to make Level System
#1

Hi all!
I try to make a level system using y_ini. I don't wanna have payday, players can only earn respect points working at jobs.
Anyone can help me with /buylevel?
Sorry for my englis, RO right there.
Reply
#2

Use a variable to store every player's level. Save the value of the variable to the player's y_ini file when the player disconnects. And load the value of the player's y_ini file to your variable when the player logs on.
Reply
#3

Already make that but...i don't have no idea how to make /buylevel command.
Reply
#4

Try to do something like that:

// On top of your script
new level[MAX_PLAYERS];

// Command
CMD:buylevel(playerid, params[])
{
GivePlayerMoney(playerid, -200);
level[playerid]=1;
return 1;
}

Sorry I don't know why [PAWN] [PAWN] not working.
Reply
#5

Quote:
Originally Posted by Tadas
Посмотреть сообщение
Try to do something like that:
pawn Код:
// On top of your script
new level[MAX_PLAYERS];

// Command
CMD:buylevel(playerid, params[])
    {
    GivePlayerMoney(playerid, -200);
    level[playerid]=1;
    return 1;
    }
Sorry I don't know why [PAWN] [PAWN] not working.
This is how
Reply
#6

Don't work man (
i edit that little bit because i have pRP on enum.
CMD:buylevel(playerid, params[])
{
if(PlayerInfo[playerid][pRP] == 50)
{
GivePlayerMoney(playerid, -200);
level[playerid]=1;
}
return 1;
}

don't work
anyone know what i need to do?

EDIT: player need to have 50 RP to buylevel
Reply
#7

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
This is how
Uhm, lol, no, it isn't.

level[playerid]=1; will always set the level to 1, which you should already know.

This will work:

pawn Код:
CMD:buylevel(playerid, params[])
{
    if(PlayerInfo[playerid][pRP] >= 50)
    {
        GivePlayerMoney(playerid, -200);
        level[playerid] += 1;
        PlayerInfo[playerid][pRP] -= 50;
    }
   
    return 1;
}
If it still doesn't work the way you want it to, please emphasize on what doesn't work, so we know what to fix!
Reply
#8

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Uhm, lol, no, it isn't.

level[playerid]=1; will always set the level to 1, as you probably already knew.

This will work:

pawn Код:
CMD:buylevel(playerid, params[])
{
    if(PlayerInfo[playerid][pRP] >= 50)
    {
        GivePlayerMoney(playerid, -200);
        level[playerid] += 1;
    }
   
    return 1;
}
If it still doesn't work the way you want it to, please emphasize on what doesn't work, so we know what to fix!
I was referring to the pawn tags, read above...
Reply
#9

Thx a lot guys! It works! edit a little bit but it works!

CMD:buylevel(playerid, params[])
{
if(PlayerInfo[playerid][pRP] >= 50)
{
GivePlayerMoney(playerid, -200);
PlayerInfo[playerid][pLevel] += 1;


}

return 1;
}
Reply
#10

pawn Код:
CMD:buylevel(playerid, params[])
{
    if(PlayerInfo[playerid][pRP] >= 50)
    {
        if(GetPlayerMoney(playerid) >= 200)
        {
            GivePlayerMoney(playerid, -200);
            level[playerid] ++;
        }
        else
            SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot afford this!");
    }
    else
        SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot use this command!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)