[Help] Making teams, tutorial fails(or I do?)
#1

Hey there. I followed this tutorial:
http://forum.sa-mp.com/index.php?topic=132845.0

And I did this:

(Not exactly what the tutorial said but if I followed to tutorial strictly, I'd get like 40 errors - fixed what obviously was wrong)

Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid)
	{
		if(classid == 0)
		{
		gTeam[playerid] = TEAM_ARMY;
		return 1;
		}
		else if(classid == 1)
		{
		gTeam[playerid] = TEAM_MERCS;
		return 1;
		}
	}
	SetPlayerPos(playerid, 877.9190,-1077.0901,24.5843);
	SetPlayerFacingAngle(playerid, 360.0000);
	SetPlayerCameraPos(playerid, 877.9275,-1072.0787,24.3923);
	SetPlayerCameraLookAt(playerid, 877.9190,-1077.0901,24.5843);
	PlayerPlaySound(playerid, 1097,0,0,0);

More code that works fine, ends with return 1; and curly braket (didn't include).
Now the error I get is:
Quote:

(316) : error 017: undefined symbol "SetPlayerTeamFromClass"

I can't find SetPlayerTeamFromClass in my pawno list in the sidebar(or maybe I just fail at looking), so is it possible I don't have this function, or that I need to download an addon or something? Only a few days old to scripting.

If someone could give me a hand here, I'd be really happy
Reply
#2

You can just do this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
  SetPlayerTeamFromClass(playerid, classid); // calls the function

  //More code here ofc xD
  return 1;
}
Then outside any callback do this:
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = TEAM_ARMY;
return 1;
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_MERCS;
return 1;
}
}
Reply
#3

Ooh I think that works, no more warnings or errors. Cool stuff, thanks bro!
Reply
#4

NVM this post, fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)