Compile Error
#1

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
Reply
#2

What's the error? Posting your code always makes it easier for people to help you!
Reply
#3

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"
Reply
#4

SetPlayerTeamFromClass is not a function existing in the SA-MP server. Try copying over the whole function from wherever you got it.
Reply
#5

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):

Reply
#6

Did you copy the whole thing into your code? It should work if you do.
Reply
#7

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
Reply
#8

pawn Код:
Function( arguments ) <- function start
{
function code
} <- function end
So you should move the whole thing down a lil bit.
Reply
#9

So.. could you maybe place the result here so I can look at it? :P
Reply
#10

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.
Reply
#11

I really dont get it xD, could you specify it a bit more please? :P
Reply
#12

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()
{

}
Reply
#13

Aaah, now it works, thanks very much ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)