SA-MP Forums Archive
problem with code - 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: problem with code (/showthread.php?tid=562524)



problem with code - Anfaradus - 09.02.2015

I've got some problems and don't know how to fix them, i looked everywhere but didin't find anything value...
Код:
D:\SA-MP GameModes\GangWars\gamemodes\Untitled.pwn(62) : error 001: expected token: "-identifier-", but found "("
D:\SA-MP GameModes\GangWars\gamemodes\Untitled.pwn(64) : error 010: invalid function or declaration
D:\SA-MP GameModes\GangWars\gamemodes\Untitled.pwn(66) : error 010: invalid function or declaration
D:\SA-MP GameModes\GangWars\gamemodes\Untitled.pwn(67) : error 010: invalid function or declaration
D:\SA-MP GameModes\GangWars\gamemodes\Untitled.pwn(68) : error 010: invalid function or declaration
D:\SA-MP GameModes\GangWars\gamemodes\Untitled.pwn(70) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Lines:
Код:
stock GetTeamZoneColor(teamid) // line 62
{
	switch(teamid) // line 64
	{
		case TEAM_GROVE: return 0x00FF0088; //line 66
		case TEAM_BALLAS: return 0xFF00FF88; //line 67
		case TEAM_VAGOS: return 0xFFFF0088; //line 68
	}
	return -1;  //line 70
}
What i'm doing wrong?


Re: problem with code - Schneider - 09.02.2015

Maybe you forget a closing bracket in the code above this function?


Re: problem with code - Raidensama - 09.02.2015

GetTeamZoneColor never used before?


Re: problem with code - CalvinC - 09.02.2015

Quote:
Originally Posted by Raidensama
Посмотреть сообщение
GetTeamZoneColor never used before?
He used stock, which means that if you don't use the function, it wont compile or give warnings/errors.


Re: problem with code - Raidensama - 09.02.2015

any errors before? where is GetTeamZoneColor used?
function compiles clearly for me


Re: problem with code - Vince - 09.02.2015

Nothing wrong with the function (though you might want to use a constant array instead). Show a few lines above that part. Might be an extra brace or bracket or something like that.


Re: problem with code - Anfaradus - 09.02.2015

here more lines:
Код:
public OnPlayerSpawn(playerid)
for(new i=0; i < sizeof(ZoneInfo); i++)
{
	GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
}

stock GetTeamZoneColor(teamid)
{
	switch[100](teamid)
	{
		case TEAM_GROVE: return 0x00FF0088;
		case TEAM_BALLAS: return 0xFF00FF88;
		case TEAM_VAGOS: return 0xFFFF0088;
	}
	return -1;
}



Re: problem with code - CalvinC - 09.02.2015

Code in functions should be put in compund blocks:
pawn Код:
public OnPlayerSpawn(playerid)
{
    for(new i=0; i < sizeof(ZoneInfo); i++)
    {
        GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
    }
    return 1;
}



Re: problem with code - Anfaradus - 09.02.2015

same problems still remains...