SA-MP Forums Archive
Got some warnings - 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: Got some warnings (/showthread.php?tid=294098)



Got some warnings - ImprezBart - 31.10.2011

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.



Re: Got some warnings - Stigg - 31.10.2011

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

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


Re: Got some warnings - [MG]Dimi - 31.10.2011

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




Re: Got some warnings - ImprezBart - 31.10.2011

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


Re: Got some warnings - Stigg - 31.10.2011

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.


Re: Got some warnings - ImprezBart - 31.10.2011

Oh lol, didn't see it, thanks