[Tutorial] How to fix "Undefined Symbol" Error
#1

How do I fix errors like this:

Code:
C:\Users\(User Name)\Desktop\sa-mp 0.3c Server\gamemodes\(GM NAME).pwn(584) : error 017: undefined symbol "bla bla bla"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
?

WHY THIS THREAD

I published this thread because I see a lot of people posting:

Quote:

"Why Undefined symbol? ?"
"But have sa-mp 0.3c!!"

Cause you have only the newest client, You have to download the last includes too.

WHY THIS ERROR

This error shows when you type something that the compiler doesn't know.

The problems can be:

1. You don't have the SA-MP server includes.
2. You made some writing mistakes.
3. You haven't created that stock, public or #define.


1. To fix the 1st you have to download the includes from the sa-mp team.
Download link

2. To fix the second press on the "Replace" window and first type the mistake, and in the second box the correction.

3.1 Don't call it.
3.2 Create a function with that name.

EXAMPLES

Example 1.
pawn Code:
public OnPlayerConnect(playerid)
{
  ShowPlayerDialog(etc...);
  return 1;
}
If this gives you an error, it's because you are using 0.3a or 0.3b.

Example 2.
pawn Code:
public OnPlayerConnect(playerid)
{
    GivePlayerMonu(playerid, 500);
    return 1;
}
Fix with

pawn Code:
public OnPlayerConnect(playerid)
{
    GivePlayerMoney(playerid, 500);
    return 1;
}
Example 3.

pawn Code:
public OnPlayerConnect(playerid)
{
    SetPlayerHealthAndArmour(playerid, 55);
    return 1;
}
To fix with:

3.1 Just don't call it

pawn Code:
public OnPlayerConnect(playerid)
{
    SetPlayerHealth(playerid, 55);
    SetPlayerArmour(playerid, 55);
    return 1;
}
or

3.2 Add that function

pawn Code:
public OnPlayerConnect(playerid)
{
    SetPlayerHealthAndArmour(playerid, 55);
    return 1;
}

stock SetPlayerHealthAndArmour(playerid, Float:Value)
{
    SetPlayerHealth(playerid, Value);
    SetPlayerArmour(playerid, Value);
    return 1;
}
Reply
#2

Nice!
Reply
#3

Thank you =)
Reply
#4

Good

Thankss
Reply
#5

Nice one bro
Reply
#6

You dont have this complete right?
What about
''Undefinied symbol 'playerid' '' or ''Undefinied symbol 'name' ''..
Reply
#7

Quote:
Originally Posted by Marricio
View Post
You dont have this complete right?
''Undefinied symbol 'playerid'
This means that the function doesn't use playerid.

Quote:
Originally Posted by ******
View Post
If they only have the client, how are they compiling the code? I've not seen anyone have a compiler issue caused by not having the server because they don't have the compiler either...
I mean that they forgot to download the newest server package.
Thanks, I writed it.

Quote:
Originally Posted by Steven82
View Post
This...is just completely stupid and useless.
Yes, this thread should be deleted, because I suck.
Reply
#8

Quote:
Originally Posted by ******
View Post
No it doesn't:

pawn Code:
foreach (Player, i)
{
    SendClientMessage(playerid, COLOR_RED, "hi");
}
That's one of my most common mistakes - using "playerid" instead of "i", "playerid" is valid there if I had declared it in foreach, but I haven't here.
How do I declare it? What does "Player" in foreach?
Can you give me the link of your script ******, please?

Thanks for help : )
Reply
#9

Quote:
Originally Posted by [GF]Sasino97
View Post
Yes, this thread should be deleted, because I suck.
Trololo.

And don't see why having the 0.3c client would do anything to the code :S
Reply
#10

Thanks, helped alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)