Help (Level thingy, easy stuff)
#1

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.
Reply
#2

Whats wrong from your CMD ?
Reply
#3

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

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;
}
Reply
#5

Where the Line ?
Try use pHp code
Reply
#6

Errors:

http://prntscr.com/9n2mn7
Reply
#7

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

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

What's that?
Reply
#9

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

I did it! Thanks though!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)