SA-MP Forums Archive
Help with teams! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with teams! (/showthread.php?tid=80866)



Help with teams! - coole210 - 06.06.2009

Heres my errors:

Код:
(247) : error 029: invalid expression, assumed zero
(251) : error 029: invalid expression, assumed zero
(255) : error 029: invalid expression, assumed zero
(259) : error 029: invalid expression, assumed zero
(263) : error 029: invalid expression, assumed zero
(267) : error 029: invalid expression, assumed zero
(271) : error 029: invalid expression, assumed zero
(271) : error 004: function "OnPlayerRequestClass" is not implemented
(273) : error 001: expected token: ";", but found "-identifier-"
(771) : error 029: invalid expression, assumed zero
(771) : error 004: function "OnPlayerSpawn" is not implemented
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Errors.
Heres error lines (EVERYTHING AROUND IT TOO):

Код:
SetPlayerToTeamColor(playerid) // LINE 771
{
	if (gTeam[playerid] == TEAM_POLICE)
	{
		SetPlayerColor(playerid, TEAM_POLICE_COLOR);
	}
	else if (gTeam[playerid] == TEAM_SWAT)
	{
		SetPlayerColor(playerid, TEAM_SWAT_COLOR);
	}
	else if (gTeam[playerid] == TEAM_MECHANIC)
	{
		SetPlayerColor(playerid, TEAM_MECHANIC_COLOR);
	}
	else if (gTeam[playerid] == TEAM_MEDIC)
	{
		SetPlayerColor(playerid, TEAM_MEDIC_COLOR);
	}
	else if (gTeam[playerid] == TEAM_SG)
	{
		SetPlayerColor(playerid, TEAM_SG_COLOR);
	}
	else if (gTeam[playerid] == TEAM_MAYOR)
	{
		SetPlayerColor(playerid, TEAM_MAYOR_COLOR);
	}
	else if (gTeam[playerid] == TEAM_HITMAN)
	{
		SetPlayerColor(playerid, TEAM_HITMAN_COLOR);
	}
	else if (gTeam[playerid] == TEAM_TAXI)
	{
		SetPlayerColor(playerid, TEAM_TAXI_COLOR);
	}
public OnPlayerSpawn(playerid)
{
	SetPlayerToTeamColor(playerid);
}
  return 1;
}
Код:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0)
	{
		gTeam[playerid] = TEAM_POLICE;
	}
	else
	{
		gTeam[playerid] = TEAM_SWAT;
	}
	else //247
	{
		gTeam[playerid] = TEAM_MECHANIC;
	}
	else //251
	{
		gTeam[playerid] = TEAM_MEDIC;
	}
	else //255
	{
		gTeam[playerid] = TEAM_SG;
	}
	else //259
	{
		gTeam[playerid] = TEAM_MAYOR;
	}
	else //263
	{
		gTeam[playerid] = TEAM_HITMAN;
	}
	else //267
	{
		gTeam[playerid] = TEAM_TAXI;
	}
public OnPlayerRequestClass(playerid, classid)//271
	SetPlayerTeamFromClass(playerid, classid)//272
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);//273
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}



Re: Help with teams! - Vince - 06.06.2009

Your SetPlayerToTeamColor callback is not finished. It misses a return and the finishing brace.


Re: Help with teams! - coole210 - 06.06.2009

Is it return 1; or return 0;?



Re: Help with teams! - cigo - 06.06.2009

you used from sftdm?


Re: Help with teams! - coole210 - 06.06.2009

It didn't fix the problem same 11 errors.


Re: Help with teams! - cigo - 06.06.2009

if you're using sftdm gamemode, it should be ok... (if you are not modified it )

i'm using sftdm as a base for my gm, i had problems to when i added more teams, you just have to think !

i hope you solve your problem!


Re: Help with teams! - yezizhu - 06.06.2009

If you're using pawno to compiler,you should add ';' when calling function.
And your SetPlayerTeamFromClass is completely error.
Please use swith&case instead of if&else
eg
pawn Код:
if(classid == 0)bla...
else bla...//this is the error
else bla...
//edited to
switch(classid){
 case 0:bla..
 case 1:bla..
 case 2:bla..
 .
 .
 .
}



Re: Help with teams! - coole210 - 06.06.2009

That didn't work here this is what i did. I got 5 errors but still not work..

Код:
SetPlayerTeamFromClass(playerid, classid)
{
	switch(classid){
	case 0:
	{
		gTeam[playerid] = TEAM_POLICE;
	}
	case 1:
	{
		gTeam[playerid] = TEAM_SWAT;
	}
  case 3:
	{
		gTeam[playerid] = TEAM_MECHANIC;
	}
	case 4:
	{
		gTeam[playerid] = TEAM_MEDIC;
	}
	case 5:
	{
		gTeam[playerid] = TEAM_SG;
	}
	case 6:
	{
		gTeam[playerid] = TEAM_MAYOR;
	}
	case 7:
	{
		gTeam[playerid] = TEAM_HITMAN;
	}
	case 8:
	{
		gTeam[playerid] = TEAM_TAXI;
	}
}

	public OnPlayerRequestClass(playerid, classid) // LINE 266
	SetPlayerTeamFromClass(playerid, classid);
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}
I still have 2 errors.

Код:
(266) : error 029: invalid expression, assumed zero
(266) : error 004: function "OnPlayerRequestClass" is not implemented



Re: Help with teams! - Luka P. - 06.06.2009

create
pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    return 1;
}



Re: Help with teams! - coole210 - 06.06.2009

Read my lines in the script above your post IT IS THERE!