Public function cannot be used (undefined?)
#1

So in gamemodes/gm.pwn I have the following on line 2505

Код:
#include "../gamemodes/inc/cell_main.inc"
The file in gamemodes/inc/cell_main.inc has the follow public (and forwarded) function:

PHP код:
public OwnsCellphone(playerid) {
    return (
PlayerInfo[playerid][pPnumber] != 0);

In the gamemode, I only use this function AFTER the file has been included, and still it gives me the following error:

Код:
error 017: undefined symbol "OwnsCellphone"
(this happens for other functions from cell_main as well)
Reply
#2

If you call the function before including the file, the compiler will not know about the function yet. Try including the file in the first few lines of your script before loading anything else. See if that makes a difference.

EDIT: I should learn to read, my bad. The way you describe it, it should work. Will look into it when I have some free time.
Reply
#3

Quote:
Originally Posted by Sellize
Посмотреть сообщение
So in gamemodes/gm.pwn I have the following on line 2505

Код:
#include "../gamemodes/inc/cell_main.inc"
The file in gamemodes/inc/cell_main.inc has the follow public (and forwarded) function:

PHP код:
public OwnsCellphone(playerid) {
    return (
PlayerInfo[playerid][pPnumber] != 0);

In the gamemode, I only use this function AFTER the file has been included, and still it gives me the following error:

Код:
error 017: undefined symbol "OwnsCellphone"
(this happens for other functions from cell_main as well)
I believe includes are suppose to be in your samp folder/pawno/includes
Reply
#4

I believe 1fret is right. I've used includes from my gamemode folder once, however those had the .pwn extension and behaved exactly the same.
Reply
#5

No, you can in fact include "modular" parts of your script via the gamemodes folder. It works for like 20+ other modules in the script, just not this one.
Reply
#6

Bump. Still had no solution to this
Reply
#7

Why is it public?
Reply
#8

Quote:
Originally Posted by OneDay
Посмотреть сообщение
Why is it public?
Public so that it's globally accessible, I tried to remove the public & forwards, but it still shows the same errors
Reply
#9

public do not mean that. do you have other file also called call_main?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)