Error with this inc?
#1

Okay, this is my first time "creating" an include so I was getting use to how to do it.

This is inside the .inc file:
pawn Код:
#include <a_samp>
#include <a_players>

native Freeze(playerid);

stock FreezePlayer(playerid)
{
    TogglePlayerControllable(playerid, 0);
}
If I have the stock as "Freeze" and compile it it says defined..

However, if I change it to FreezePlayer it works. But when I add #include <Freeze> to the server it compiles all good.
pawn Код:
CMD:freeze(playerid, params[])
{
    Freeze(playerid);
    return 1;
}
But I get this in the console:
pawn Код:
[15:00:13] Script[gamemodes/TDM.amx]: Run time error 19: "File or function is not found"
[15:00:13] Number of vehicle models: 0
EDIT: I looked at bLibary include and it has native Freeze(playerid);
and stock Freeze(playerid); but no errors :/
Reply
#2

You're confusing me.

Why is your native Freeze but your stock is FreezePlayer?
What happens if you just both name them FreezePlayer?
Reply
#3

pawn Код:
error 021: symbol already defined: "FreezePlayer
Reply
#4

And both to Freeze2? (to make sure theres not a double function here)
Reply
#5

error 021: symbol already defined: "Freeze2"

I've added you on Skype so you can come on TV so I can show you whats happening
Reply
#6

freeze.inc
pawn Код:
/*
native FreezePlayer(playerid);
*/

#if defined _freeze_included
    #endinput
#endif
#define _freeze_included

stock FreezePlayer(playerid)
{
    TogglePlayerControllable(playerid, 0);
    return 1;
}
gamemode.pwn
pawn Код:
#include < a_samp >
#include < zcmd >
#include < freeze >

CMD:freeze(playerid, params[] )
{
    return FreezePlayer(playerid);
}
It compiled fine and it should work.
Reply
#7

If you only modify a native than do it like that
pawn Код:
native Freeze(playerid, bool: toggle = false) = TogglePlayerControllable;
native UnFreeze(playerid, bool: toggle = true) = TogglePlayerControllable;
Otherwise just do it like that
pawn Код:
/*
native Freeze(playerid);
native UnFreeze(playerid);
*/


static
    bool: gPlayerFrozen[MAX_PLAYERS char]
;

stock bool: IsPlayerFrozen(playerid) {
    return gPlayerFrozen{playerid};
}

stock Freeze(playerid) {
    return TogglePlayerControllable(playerid, (gPlayerFrozen{playerid} = false));
}

stock UnFreeze(playerid) {
    return TogglePlayerControllable(playerid, (gPlayerFrozen{playerid} = true));
}
Reply
#8

Well, that's a bit confusing if I want to continue making them.. I've just started on them and I'd prefer it if it was just native..

However, I looked at a similar include (bLibrary) and they don't have anything like the code above. Just native ....

EDIT:

I added /* */ tags around the natives and it worked.
Thanks anyway.
Reply
#9

You use native if you have a plugin, otherwise you don't use it.
Reply
#10

Quote:
Originally Posted by maramizo
Посмотреть сообщение
You use native if you have a plugin, otherwise you don't use it.
You do if you make an include with new functions and you just want them to appear to the right side of panwo. Otherwise, you can add the native to your gamemode only if it's from a plugin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)