Okay im returning to coding and im still a beginner. I tried to use CallHook before but I cannot understand what exactly a bool in a call hook works?
When I type Puts(targetEntity.OwnerID + source); it send IDs correctly.
The IsSameClan is set to receive the 2 IDS and check if they belong to the same clan.
Now, when I look at this line:
if ((bool)(Clans?.CallHook("IsSameClan", targetEntity.OwnerID, source) ?? true))
{Puts(targetEntity.OwnerID + source); // it send IDs to console log correctly.}
else
{return;}
bool is true/false okay. What about the true at the end? Does that mean after callhook and validating the 2 ids on IsSameClan, if it returns TRUE, then continue, if not, then go to else part?
If I set the "?? false", does it mean if after validating it returns FALSE, then continue?
I tried changing both true and false but when I set True at the end of the line, it FORCES to return as true. If set to false, it FORCES to return as false.... I really don't understand how this line is useful if both true or false I write at the end returns to the true or false I write. :/ help xD
CallHook ?? true/false?
Discussion in 'Rust Development' started by FireBurst, Apr 15, 2018.
-
Wulf Community Admin
That line means "use the result of the hook call, or true if no result" essentially.