[SOLVED] Need help with /buylevel command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Need help with /buylevel command (
/showthread.php?tid=136848)
[SOLVED] Need help with /buylevel command -
leapfish - 26.03.2010
Hello guys, I need little help with this command...
Here is the code
pawn Код:
dcmd_buylevel(playerid, cmdtext[]) {
#pragma unused cmdtext
new str[256];
if(PlayerInfo[playerid][Level] == 10) return SendClientMessage(playerid, COLOR_RED, "You have reached highest level and can't buy any more");
if(PlayerInfo[playerid][Level] == 0 && PlayerInfo[playerid][Exppoints] >= LVL_1 && GetPlayerMoney(playerid) >= MLVL_1)
{
//something
}
if(PlayerInfo[playerid][Level] == 1 && PlayerInfo[playerid][Exppoints] >= LVL_2 && GetPlayerMoney(playerid) >= MLVL_2)
{
//something
}
if(PlayerInfo[playerid][Level] == 2 && PlayerInfo[playerid][Exppoints] >= LVL_3 && GetPlayerMoney(playerid) >= MLVL_3)
{
//something
//MORE OF THESE BELOW....
//..............
//..............
}
else
{
SendClientMessage(playerid, COLOR_RED, "You don't have enough cash or experience.");
}
return 1;
}
Everything works fine, except when I try /buylevel it does everything good but it shows "You don't have enough cash or experience." even it works... it always show that message, can anyone help please!?
Re: Need help with /buylevel command -
MadeMan - 26.03.2010
Change the middle part to
else if
pawn Код:
dcmd_buylevel(playerid, cmdtext[]) {
#pragma unused cmdtext
new str[256];
if(PlayerInfo[playerid][Level] == 10) return SendClientMessage(playerid, COLOR_RED, "You have reached highest level and can't buy any more");
if(PlayerInfo[playerid][Level] == 0 && PlayerInfo[playerid][Exppoints] >= LVL_1 && GetPlayerMoney(playerid) >= MLVL_1)
{
//something
}
else if(PlayerInfo[playerid][Level] == 1 && PlayerInfo[playerid][Exppoints] >= LVL_2 && GetPlayerMoney(playerid) >= MLVL_2)
{
//something
}
else if(PlayerInfo[playerid][Level] == 2 && PlayerInfo[playerid][Exppoints] >= LVL_3 && GetPlayerMoney(playerid) >= MLVL_3)
{
//something
//MORE OF THESE BELOW....
//..............
//..............
}
else
{
SendClientMessage(playerid, COLOR_RED, "You don't have enough cash or experience.");
}
return 1;
}
Re: Need help with /buylevel command -
leapfish - 26.03.2010
Thanks MadeMan, it's working now