#error
#1

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)
Reply
#2

#error is a preprocessor directive. It can only be called during compilation.

To return values, you obviously use the return keyword ..
Reply
#3

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
Reply
#4

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.
Reply
#5

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.
Reply
#6

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
Reply
#7

Never mind solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)