SA-MP Forums Archive
Help (Level thingy, easy stuff) - 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: Help (Level thingy, easy stuff) (/showthread.php?tid=597967)



Help (Level thingy, easy stuff) - manishmulchandani01 - 07.01.2016

Hello there, I'm trying to create a cmd called '/buylevel'. I've already wrote 'pLevel' thingy and 'pPlayingHours' I just need help how can i create cmd? I mean, I want something like this when we buy level we need 8 playing hours, and hours 4 increases per level, like 8 hours in level 1 and 12 in lvl 22 and so on.
Thanks in advance.


Re: Help (Level thingy, easy stuff) - Amunra - 07.01.2016

Whats wrong from your CMD ?


Re: Help (Level thingy, easy stuff) - saffierr - 07.01.2016

I honestly don't understand what you are trying to say...


Re: Help (Level thingy, easy stuff) - manishmulchandani01 - 07.01.2016

Errors:
D:\Adv-Gaming\SampSvr (RP)\Script\gamemodes\roleplay.pwn(38001) : warning 209: function "cmd_buylevel" should return a value
D:\Adv-Gaming\SampSvr (RP)\Script\gamemodes\roleplay.pwn(38002) : error 054: unmatched closing brace ("}")
D:\Adv-Gaming\SampSvr (RP)\Script\gamemodes\roleplay.pwn(38003) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

My /buylevel cmd:

CMD:buylevel(playerid, params[])
{
//if (gPlayerLogged{playerid} != 0)
//{
//if(PlayerData[playerid][pLevel] >= 0)
//{
new nxtlevel = PlayerData[playerid][pLevel]+1;
new costlevel = nxtlevel*levelcost;
new playinghoursamount = nxtlevel*levelplayinghours;
//if (GetMoney(playerid) < 500)
if(GetMoney(playerid) < costlevel)
{
new string[128];
format(string, sizeof(string), "You don't have enough cash ($%d).",costlevel);
SendClientMessageEx(playerid, COLOR_WHITE, string);
return 1;
}
else if (PlayerData[playerid][pPlayingHours] < playinghoursamount)
{
new string[58];
format(string, sizeof(string), "You need %d more respect points to buy your next level.", playinghoursamount - PlayerData[playerid][pPlayingHours]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
return 1;
}
else
{
new string[92];
format(string, sizeof(string), "~g~LEVEL UP~n~~w~You are now Level %d", nxtlevel);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GiveMoney(playerid, (-costlevel));
PlayerData[playerid][pLevel]++;
PlayerData[playerid][pPlayingHours] = PlayerData[playerid][pPlayingHours]-playinghoursamount;
//PlayerData[playerid][gPupgrade] = PlayerData[playerid][gPupgrade]+2;
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "You have bought level %d for $%d", nxtlevel, costlevel);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SetPlayerScore(playerid, PlayerData[playerid][pLevel]);
}
}
}
return 1;
}


Re: Help (Level thingy, easy stuff) - Amunra - 07.01.2016

Where the Line ?
Try use pHp code


Re: Help (Level thingy, easy stuff) - manishmulchandani01 - 07.01.2016

Errors:

http://prntscr.com/9n2mn7


Re: Help (Level thingy, easy stuff) - Amunra - 07.01.2016

Under Line 37999 : SetPlayerScore(.......);
PHP код:
            SetPlayerScore(.......);
            return 
1
And Show more code using pastebin


Re: Help (Level thingy, easy stuff) - manishmulchandani01 - 07.01.2016

D:\Adv-Gaming\SampSvr (RP)\Script\gamemodes\roleplay.pwn(38003) : error 054: unmatched closing brace ("}")

What's that?


Re: Help (Level thingy, easy stuff) - Amunra - 07.01.2016

I Cant see Your Full "CMD:buylevel" Please Screenshot all sections


Re: Help (Level thingy, easy stuff) - manishmulchandani01 - 07.01.2016

I did it! Thanks though!