SA-MP Forums Archive
return error - 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: return error (/showthread.php?tid=562568)



return error - IndependentGaming - 09.02.2015

Hello when i compile my script im getting this warning but i dont know what is wrong with the command ?

Warning:
Код:
warning 209: function "cmd_giveweaponlic" should return a value
Command:
Код:
CMD:giveweaponlic(playerid, params[])
{
	if(IsACop(playerid))
	{
	    new giveplayerid;
	    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveweaponlic [playerid]");
	    if(PlayerInfo[giveplayerid][pGunLic] == 0)
	    {
		    if(PlayerInfo[giveplayerid][pGunLic] == 0)
		    {
		        PlayerInfo[giveplayerid][pGunLic] = 1;
				SendClientMessage(playerid, COLOR_WHITE, "You have given a weapon license!");
		    }
			else
			{
			    SendClientMessage(playerid, COLOR_WHITE, "That person already got a weapon license!");
			}
		}
		return 1;
	}
}



Re: return error - Sascha - 09.02.2015

pawn Код:
CMD:giveweaponlic(playerid, params[])
{
    if(IsACop(playerid))
    {
        new giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveweaponlic [playerid]");
        if(PlayerInfo[giveplayerid][pGunLic] == 0)
        {
            if(PlayerInfo[giveplayerid][pGunLic] == 0)
            {
                PlayerInfo[giveplayerid][pGunLic] = 1;
                SendClientMessage(playerid, COLOR_WHITE, "You have given a weapon license!");
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "That person already got a weapon license!");
            }
        }
        return 1;
    }
        return 1;
}



Re: return error - IndependentGaming - 09.02.2015

Not working

Код:
warning 217: loose indentation
on the line last return


Re: return error - Sascha - 09.02.2015

that just means that the "tabs" are set in an unusual way.. it works without any problems though...

to get rid of the warning, change the distance to the left like this:
pawn Код:
CMD:giveweaponlic(playerid, params[])
{
    if(IsACop(playerid))
    {
        new giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveweaponlic [playerid]");
        if(PlayerInfo[giveplayerid][pGunLic] == 0)
        {
            if(PlayerInfo[giveplayerid][pGunLic] == 0)
            {
                PlayerInfo[giveplayerid][pGunLic] = 1;
                SendClientMessage(playerid, COLOR_WHITE, "You have given a weapon license!");
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "That person already got a weapon license!");
            }
        }
        return 1;
    }
    return 1;
}