Compile Error - 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: Compile Error (
/showthread.php?tid=184345)
Compile Error -
Ladathion - 19.10.2010
Im a total noob at scripting and I only know some basics.. but Im trying to make a TDM Server and hopefully learn something of scripting while Im making it, but today I got a compile error in line 56 which is
Quote:
SetPlayerTeamFromClass(playerid, classid)
|
Anyone knows what the problem is? If its neccesary ill post line 50-60 here.
Thanks in advance,
Ladathion
Re: Compile Error -
Slice - 19.10.2010
What's the error? Posting your code always makes it easier for people to help you!
Re: Compile Error -
Ladathion - 19.10.2010
Quote:
Originally Posted by g_aSlice
What's the error? Posting your code always makes it easier for people to help you!
|
This is my error:
Код:
C:\Users\Patrick\Desktop\Ladarc DM\gamemodes\ladarcdm.pwn(56) : error 017: undefined symbol "SetPlayerTeamFromClass"
Re: Compile Error -
Slice - 19.10.2010
SetPlayerTeamFromClass is not a function existing in the SA-MP server. Try copying over the whole function from wherever you got it.
Re: Compile Error -
Ladathion - 19.10.2010
This is the website I got it from, the SA-MP Wiki, and the quote of the exact place I got it from:
Quote:
Код:
SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
gTeam[playerid] = TEAM_GROVE;
}
else
{
gTeam[playerid] = TEAM_BALLA;
}
}
Place that code OUTSIDE a function in your code (as it is a new function) and put these lines as the first things after the open curly braces in your OnPlayerRequestClass callback (notice the way the variables are not global so we are having to pass them to out function too):
|
Re: Compile Error -
Slice - 19.10.2010
Did you copy the whole thing into your code? It should work if you do.
Re: Compile Error -
Ladathion - 19.10.2010
This is the part that I copied it to,
The guide sed I had to do this:
Quote:
Place that code OUTSIDE a function in your code (as it is a new function) and put these lines as the first things after the open curly braces in your OnPlayerRequestClass callback (notice the way the variables are not global so we are having to pass them to out function too):
|
So I did that... I guess :P
Re: Compile Error -
Slice - 19.10.2010
pawn Код:
Function( arguments ) <- function start
{
function code
} <- function end
So you should move the whole thing down a lil bit.
Re: Compile Error -
Ladathion - 19.10.2010
So.. could you maybe place the result here so I can look at it? :P
Re: Compile Error -
Slice - 19.10.2010
I could do that. But you wouldn't learn anything. Try and figure out.

It'll be more fun once you get it all working if you did it by yourself.
Re: Compile Error -
Ladathion - 19.10.2010
I really dont get it xD, could you specify it a bit more please? :P
Re: Compile Error -
Slice - 19.10.2010
Basically, you're placing a function declaration inside another function. You can't do that in PAWN.
Example of bad usage:
pawn Код:
MyFunction()
{
MyOtherFunction()
{
}
}
Example of good usage:
pawn Код:
MyFunction()
{
}
MyOtherFunction()
{
}
Re: Compile Error -
Ladathion - 19.10.2010
Aaah, now it works, thanks very much ^^