SA-MP Forums Archive
How to make Level System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make Level System (/showthread.php?tid=522207)



How to make Level System - prooftzm - 26.06.2014

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.


Re: How to make Level System - RedFusion - 26.06.2014

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.


Re: How to make Level System - prooftzm - 26.06.2014

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


Re: How to make Level System - Tadas - 26.06.2014

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.


Re: How to make Level System - RedFusion - 26.06.2014

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


Re: How to make Level System - prooftzm - 26.06.2014

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


Re: How to make Level System - Dignity - 26.06.2014

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!


Re: How to make Level System - RedFusion - 26.06.2014

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


Re: How to make Level System - prooftzm - 26.06.2014

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;
}


Re: How to make Level System - RedFusion - 26.06.2014

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;
}