[Help] Making teams, tutorial fails(or I do?) - 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] Making teams, tutorial fails(or I do?) (
/showthread.php?tid=123608)
[Help] Making teams, tutorial fails(or I do?) -
CrucixTM - 26.01.2010
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
Re: [Help] Making teams, tutorial fails(or I do?) -
Fj0rtizFredde - 26.01.2010
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;
}
}
Re: [Help] Making teams, tutorial fails(or I do?) -
CrucixTM - 26.01.2010
Ooh I think that works, no more warnings or errors. Cool stuff, thanks bro!
Re: [Help] Making teams, tutorial fails(or I do?) -
CrucixTM - 26.01.2010
NVM this post, fixed