Condition Operator ( ? : ) Jan 19, 2017 23:07:17 GMT RaDNoX likes this Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by DoNii on Jan 19, 2017 23:07:17 GMT Condition Operator is an useful operator stimulated to do two (2) checks : if/else if.Syntax : arg1 ? arg2 : arg3Explanation : If arg1 is true, do arg2 else if arg1 is false do arg3Example : This will check if user is alive on spawn and will print "You're Alive" otherwise if he's dead it'll print "You're Dead"#include <amxmodx>#include <hamsandwich>#define PLUGIN "Condition Operator Tut"#define VERSION "1.0"#define AUTHOR "DoNii"public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Spawn, "player", "fw_HamSpawnPost", 1)}public fw_HamSpawnPost(id) { is_user_alive(id) ? client_print(id, print_chat, "You're Alive") : client_print(id, print_chat, "You're Dead")}This is the same as this#include <amxmodx>#include <hamsandwich>#define PLUGIN "Condition Operator Tut"#define VERSION "1.0"#define AUTHOR "DoNii"public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Spawn, "player", "fw_HamSpawnPost", 1)}public fw_HamSpawnPost(id) { if(is_user_alive(id)) { client_print(id, print_chat, "You're Alive") } else if(!is_user_alive(id)) { client_print(id, print_chat, "You're Dead") }}But a lot easier and shorter
Condition Operator ( ? : ) Jan 20, 2017 14:34:40 GMT DoNii likes this Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by zmd94 on Jan 20, 2017 14:34:40 GMT Nice sharing.
Condition Operator ( ? : ) Jan 20, 2017 19:07:23 GMT DoNii likes this Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by LegendofWarior on Jan 20, 2017 19:07:23 GMT Awesome, this will be very helpful.
Condition Operator ( ? : ) May 8, 2017 6:16:35 GMT via mobile ZinoZack47 likes this Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by RaDNoX on May 8, 2017 6:16:35 GMT @donii sensai is it possible to add many cases say:arg1 ? arg2 ? arg3? : arg4you did mention to do (2) checks but still asking
Condition Operator ( ? : ) May 8, 2017 21:26:53 GMT via mobile Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by ZinoZack47 on May 8, 2017 21:26:53 GMT May 8, 2017 6:16:35 GMT RaDNoX said:@donii sensai is it possible to add many cases say:arg1 ? arg2 ? arg3? : arg4you did mention to do (2) checks but still asking Good question man.
Condition Operator ( ? : ) May 8, 2017 21:40:13 GMT Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by DoNii on May 8, 2017 21:40:13 GMT May 8, 2017 6:16:35 GMT RaDNoX said:@donii sensai is it possible to add many cases say:arg1 ? arg2 ? arg3? : arg4you did mention to do (2) checks but still asking How does that make sense?
Condition Operator ( ? : ) May 9, 2017 4:08:41 GMT via mobile Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by RaDNoX on May 9, 2017 4:08:41 GMT If arg1 is true so arg2 of arg2 is true do arg3 else if arg1 is flash do arg4 ...I understand your point this won't work.... tnx
Condition Operator ( ? : ) May 9, 2017 10:49:53 GMT RaDNoX likes this Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by DoNii on May 9, 2017 10:49:53 GMT As far as I know that's not possible, you can do that with 'if' and 'else if'.
Condition Operator ( ? : ) May 12, 2017 21:46:25 GMT via mobile Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by Abhinash ( Bboy NeO ) on May 12, 2017 21:46:25 GMT That's very useful.Your tutorial made my New Addon efficient coded.
Condition Operator ( ? : ) May 13, 2017 7:06:55 GMT Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by DoNii on May 13, 2017 7:06:55 GMT It's not about efficiency, it's about shortening your code.
Condition Operator ( ? : ) May 23, 2017 13:08:43 GMT via mobile Quote Select PostDeselect PostLink to PostMemberGive GiftBack to Top Post by CrazY. on May 23, 2017 13:08:43 GMT ? = Then | : = Else(If) g_number ? (Then) 123 : (Else) "abc"You don't need to make a book to explain a simple question.