Got some warnings
#1

PHP код:
CMD:levelup(playeridparams[])
{
    if(
PlayerInfo[playerid][pLevel] >= 0)
    {
        new 
nxtlevel PlayerInfo[playerid][pLevel]+1;
        new 
expamount nxtlevel*levelexp;
        new 
infostring[128];
    if (
PlayerInfo[playerid][pExp] < expamount)
    {
        
format(infostring128"[D-RP]: {FFFFFF}You need %d Experience Points, you currently have [%d] !",expamount,PlayerInfo[playerid][pExp]);
        
SendClientMessage(playeridCOLOR_LIGHTREDinfostring);
        return 
1;
    }
    else
    {
         new 
string[128];
        
format(stringsizeof(string), "~b~LEVEL UP~n~~w~You Are Now Level %d"PlayerInfo[playerid][pLevel]);
        
PlayerInfo[playerid][pLevel]++;
    }
    return 
1;
    }

Here are the warnings


Код:
C:\Users\Bart\Downloads\Script\Downtown Roleplay Development\LSC-RP\gamemodes\drp.pwn(1880) : warning 217: loose indentation
C:\Users\Bart\Downloads\Script\Downtown Roleplay Development\LSC-RP\gamemodes\drp.pwn(1894) : warning 209: function "cmd_levelup" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#2

Loose indentation move this:
pawn Код:
new string[128];
back one space.

Put another:
pawn Код:
return 1;
at the end of your cmd.
Reply
#3

PHP код:
CMD:levelup(playeridparams[])
{
    if(
PlayerInfo[playerid][pLevel] >= 0)
    {
        new 
nxtlevel PlayerInfo[playerid][pLevel]+1;
        new 
expamount nxtlevel*levelexp;
        new 
infostring[128];
        if(
PlayerInfo[playerid][pExp] < expamount)
        {
            
format(infostring128"[D-RP]: {FFFFFF}You need %d Experience Points, you currently have [%d] !",expamount,PlayerInfo[playerid][pExp]);
            
SendClientMessage(playeridCOLOR_LIGHTREDinfostring);
            return 
1;
        }
        else
        {
             new 
string[128];
            
format(stringsizeof(string), "~b~LEVEL UP~n~~w~You Are Now Level %d"PlayerInfo[playerid][pLevel]);
            
PlayerInfo[playerid][pLevel]++;
            return 
1;
        }
    }

Reply
#4

Quote:

C:\Users\Bart\Downloads\Script\Downtown Roleplay Development\LSC-RP\gamemodes\drp.pwn(1894) : warning 209: function "cmd_levelup" should return a value

Still got this problem
Reply
#5

Quote:
Originally Posted by ImprezBart
Посмотреть сообщение
Still got this problem
You need to put:
pawn Код:
return 1;
At the end of your cmd, already told you this. The warnings telling you the cmd should return a value.
Reply
#6

Oh lol, didn't see it, thanks
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)