#error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: #error (
/showthread.php?tid=336936)
#error -
RollTi - 24.04.2012
Is it possible to add #error
Ex.
i just want only true/false in my stock func and if player puts value instead of bool:true/false
the #error func will be called
+
i don't want to be annoying user anymore so i post this in public
How to make a GetPlayerBlahBlahBlah
like
Код:
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DANCE1)
that is example only here is what i want to do
Код:
if(GetPlayerStockFunc(playerid) == true/false)
Re: #error -
Vince - 24.04.2012
#error is a preprocessor directive. It can only be called during compilation.
To return values, you obviously use the
return keyword ..
Re: #error -
RollTi - 24.04.2012
Quote:
Originally Posted by Vince
#error is a preprocessor directive. It can only be called during compilation.
To return values, you obviously use the return keyword ..
|
Thanks how about this one?
Quote:
Originally Posted by RollTi
How to make a GetPlayerBlahBlahBlah
like
Код:
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DANCE1)
that is example only here is what i want to do
Код:
if(GetPlayerStockFunc(playerid) == true/false)
|
EDIT:
i get error in this line
pawn Код:
if(toggle < 0 || toggle > 1) return #error TogglePlayerAFK doesn't support value only true/false (bool) #endif
Re: #error -
2KY - 24.04.2012
pawn Код:
if ( toggle < 0 || toggle > 1 ) return SendClientMessage( playerid, -1, "TogglePlayerAFK doesn't support value only true/false (bool)" );
Alternatively you could have used print, but #error is an odd way to do things... You're making things much harder than it has to be on yourself.
Re: #error -
Vince - 24.04.2012
I told him already that #error is pre-processor directive. It cannot determine what the value of 'toggle' is at compile time, only at runtime. You might try looking at
assert if you want to indicate a programmer's error, although that one doesn't always work.
Re: #error -
Sasino97 - 24.04.2012
Try using assert, example:
pawn Код:
TogglePlayer_Ex(toggle); // Toggle can be 1 or 0 in this case
{
assert toggle < 2;
assert toggle > -1;
TogglePlayer_(toggle);
return 1;
}
It won't do what you want, but it's a similar thing
Re: #error -
RollTi - 25.04.2012
Never mind solved