How many && can you use in a IF structure? -
Lucky13 - 28.01.2016
The question is simple. I'm wondering how many && can you use in a if structure-..is there a limit or?
Re: How many && can you use in a IF structure? -
SumX - 28.01.2016
I don't think that it has a limit, but I may be wrong, just guessing, but why?
Re: How many && can you use in a IF structure? -
Lucky13 - 28.01.2016
I'm developing a Roleplay server and some commands require you to have certain things. ( such as not be cuffed, be spawned, not AFK etc-.. )
Re: How many && can you use in a IF structure? -
JamalMaddox - 28.01.2016
Well I'm not sure but it can be used after "%d", &[...]. Not quite sure tho.
Re: How many && can you use in a IF structure? -
Sithis - 28.01.2016
I don't believe there is a limit, but do take performance into account. Using lots of && might have worse performance than a well structured database query.
Re: How many && can you use in a IF structure? -
Lucky13 - 28.01.2016
Thank you for the answers and Sithis, nice posts count xD
Re: How many && can you use in a IF structure? -
Misiur - 28.01.2016
As a sidenote: If you are interested check out y_groups, you can filter commands by player groups.
Re: How many && can you use in a IF structure? -
Sithis - 28.01.2016
y_groups is a good feature indeed!
To Lucky13: What kind of code are you creating, are you using mysql? If you want, I might be able to assist you with joins and stuff if you really want an efficient system. Feel free to drop me a PM and we'll sort it out via Skype.
Re: How many && can you use in a IF structure? -
Pottus - 28.01.2016
Quote:
Originally Posted by Lucky13
I'm developing a Roleplay server and some commands require you to have certain things. ( such as not be cuffed, be spawned, not AFK etc-.. )
|
In that case you are best to just stack if() return one lines ex.
Код:
if(!p_DATA[playerid][p_Cuffed]) return SendClientMessage(...);
if(!p_DATA[playerid][p_AFK]) return SendClientMessage(...);
Re: How many && can you use in a IF structure? -
xTURBOx - 29.01.2016
Quote:
Originally Posted by Pottus
In that case you are best to just stack if() return one lines ex.
Код:
if(!p_DATA[playerid][p_Cuffed]) return SendClientMessage(...);
if(!p_DATA[playerid][p_AFK]) return SendClientMessage(...);
|
i prefer this cause you can have separate error messages(eg: if cuffed"ERROR

layer is cuffed, you cannot use this cmd on him",if afk"ERROR

layer is afk. you cannot use this command on him"
