how to make this source work.

Brynner

Community Contributors
Messages
563
Points
0
Github
https://github.com/bgamez23
if( pc_has_permission(sd,PC_ANNOUNCE_TRADE) ) gm_sd = sd; if( pc_has_permission(target_sd,PC_ANNOUNCE_TRADE) ) gm_sd = target_sd; else gm_sd = NULL; 

i'm confuse using the if else and else if. thanks in advance.

 
Code:
    if( pc_has_permission(sd,PC_ANNOUNCE_TRADE) )		gm_sd = sd;    else if( pc_has_permission(target_sd,PC_ANNOUNCE_TRADE) )		gm_sd = target_sd;	else		gm_sd = NULL; 
 
hmmm how about if i join the 

else ( pc_has_permission(sd,PC_ANNOUNCE_TRADE) )&&( pc_has_permission(target_sd,PC_ANNOUNCE_TRADE) )

gm_sd = NULL;

is this possible?

 
Last edited by a moderator:
"else" doesnt take any arguments

Its like

if A = 1 then this

else

this

What you can do is an "else if"

if A = 1 then this (Do this if A is equal to 1)

else if A = 2 do this2 (if A is not equal to 1 but equal to 2 do this2)

else do that (If A is not equal to 1 and is NOT euql to 2, do that)

I am not entirely sure what are you trying to achieve with that code but this makes more sense than what you said on your last post

if( !pc_has_permission(sd,PC_ANNOUNCE_TRADE) && !pc_has_permission(target_sd,PC_ANNOUNCE_TRADE) )    gm_sd = NULL; 
Which basicalle says, If "sd" does not have PC_ANNOUNCE_TRADE permissions, and target_sd does not have PC_ANNOUNCE_TRADE permissions, then gm_sd is null. 

 
Back
Top