SA-MP Forums Archive
Help me with this: invalid function or declaration - 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 me with this: invalid function or declaration (/showthread.php?tid=581202)



Help me with this: invalid function or declaration - RotAway - 11.07.2015

Код:
C:\Users\NoConviction\Desktop\VG\gamemodes\HRP_9.0.pwn(60249) : error 010: invalid function or declaration
C:\Users\NoConviction\Desktop\VG\gamemodes\HRP_9.0.pwn(60251) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Код:
forward OnPlayerModelSelection(playerid, response, listid, modelid);
public OnPlayerModelSelection(playerid, response, listid, modelid){
{
	if(listid == DUTYSKINS)
	{
	    if(response)
	    {
    		SetPlayerSkin(playerid, modelid);
   		}
	}
}
	if(listid == UNDERCOVERSKINS)
	{
	    if(response)
	    {
    		SetPlayerSkin(playerid, modelid);
   		}
	}
}
	if(listid == FDUTYSKINS)
	{
	    if(response)
	    {
	        SetPlayerSkin(playerid, modelid);
		}
	}
}
What's wrong with this (Last lines)


Re: Help me with this: invalid function or declaration - Vince - 11.07.2015

Your braces don't match up. The opening brace I marked in ORANGE has a closing brace I marked in RED and the last lines are below that closing brace and thus outside the callback and thus invalid.
Код:
forward OnPlayerModelSelection(playerid, response, listid, modelid);
public OnPlayerModelSelection(playerid, response, listid, modelid){
{
	if(listid == DUTYSKINS)
	{
	    if(response)
	    {
    		SetPlayerSkin(playerid, modelid);
   		}
	}
}
	if(listid == UNDERCOVERSKINS)
	{
	    if(response)
	    {
    		SetPlayerSkin(playerid, modelid);
   		}
	}
}
	if(listid == FDUTYSKINS)
	{
	    if(response)
	    {
	        SetPlayerSkin(playerid, modelid);
		}
	}
}
Solution: remove the red brace. The blue braces, while valid code, serve no purpose and can also be removed.


Re: Help me with this: invalid function or declaration - RotAway - 11.07.2015

FIXED ! Thank you very much And +1 rep for you !