Error with this inc? -
Elysian` - 16.12.2012
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 :/
Re: Error with this inc? -
Mike_Peterson - 16.12.2012
You're confusing me.
Why is your native Freeze but your stock is FreezePlayer?
What happens if you just both name them FreezePlayer?
Re: Error with this inc? -
Elysian` - 16.12.2012
pawn Код:
error 021: symbol already defined: "FreezePlayer
Re: Error with this inc? -
Mike_Peterson - 16.12.2012
And both to Freeze2? (to make sure theres not a double function here)
Re: Error with this inc? -
Elysian` - 16.12.2012
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
Re: Error with this inc? -
Konstantinos - 16.12.2012
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.
AW: Re: Error with this inc? -
Nero_3D - 16.12.2012
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));
}
Re: Error with this inc? -
Elysian` - 16.12.2012
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.
Re: Error with this inc? -
maramizo - 16.12.2012
You use native if you have a plugin, otherwise you don't use it.
Re: Error with this inc? -
Konstantinos - 16.12.2012
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.