Page 1 of 1

ze_get_vip_flags

Posted: 26 Aug 2018, 01:14
by Mark
What is the correct way to get more then one flag as a check.
  1.         if(ze_get_vip_flags(id) & VIP_A | VIP_E)
  2.         if(ze_get_vip_flags(id) && VIP_A | VIP_E)
  3.         if(ze_get_vip_flags(id) & VIP_A || VIP_E)
  4.         if(ze_get_vip_flags(id) & VIP_A & VIP_E)
I want them to have both of these flag before they can do something.

Re: ze_get_vip_flags

Posted: 26 Aug 2018, 02:42
by Raheem
Here the 3 ways are same, use any one:
    1. if (ze_get_vip_flags(id) & (VIP_A|VIP_E))
    2. if ((ze_get_vip_flags(id) & VIP_A) && (ze_get_vip_flags(id) & VIP_E))
    3. if ((ze_get_vip_flags(id) & read_flags("ae"))

Re: ze_get_vip_flags

Posted: 26 Aug 2018, 04:15
by Mark
Raheem wrote: 5 years ago Here the 3 ways are same, use any one:
    1. if (ze_get_vip_flags(id) & (VIP_A|VIP_E))
    2. if ((ze_get_vip_flags(id) & VIP_A) && (ze_get_vip_flags(id) & VIP_E))
    3. if ((ze_get_vip_flags(id) & read_flags("ae"))
Do you know why this would not call the last else statement when a user is not a VIP it always calls the second one.
  1. public cmd_coins(id)
  2. {
  3.  
  4.     new nv = nvault_open(NV_NAME);
  5.    
  6.     if(nv == INVALID_HANDLE)
  7.     {
  8.         client_print(id,print_chat,"%s For the moment getting coins system is inactive..",TAG);
  9.         return;
  10.     }
  11.    
  12.     new txt_min[32],txt_coins[10];
  13.     new coins = get_pcvar_num(cvar_coins),pminutes = get_pcvar_num(cvar_time);
  14.     copy(txt_coins,charsmax(txt_coins),(coins==1)?"coin":"coins");
  15.     build_time(pminutes,txt_min,charsmax(txt_min));
  16.    
  17.     if(g_player[id][ftime])
  18.     {
  19.         if ((ze_get_vip_flags(id) & VIP_A) && (ze_get_vip_flags(id) & VIP_E))
  20.         {
  21.             client_print(id,print_chat,"%s You have just received 150 free %s, get another in %s !",TAG,coins,txt_coins,txt_min);
  22.             ze_set_escape_coins(id, ze_get_escape_coins(id) + 150);
  23.             g_player[id][ftime]=false;
  24.             nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
  25.             return;
  26.         }
  27.         else if (ze_get_vip_flags(id) & VIP_A)
  28.         {
  29.             client_print(id,print_chat,"%s You have just received 100 free %s, get another in %s !",TAG,coins,txt_coins,txt_min);
  30.             ze_set_escape_coins(id, ze_get_escape_coins(id) + 100);
  31.             g_player[id][ftime]=false;
  32.             nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
  33.             return;
  34.         }
  35.         else
  36.         {
  37.             client_print(id,print_chat,"%s You have just received %d %s, get another in %s !",TAG,coins,txt_coins,txt_min);
  38.             ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);
  39.             g_player[id][ftime]=false;
  40.             nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
  41.             return;
  42.         }
  43.     }
  44.  
  45.     new user_time=get_systime()-g_player[id][mtime];
  46.     new diff_min=(user_time<(pminutes*60))?pminutes-(user_time/60):pminutes;
  47.     build_time(diff_min,txt_min,charsmax(txt_min));
  48.    
  49.     if(user_time>=(pminutes*60))
  50.     {
  51.         if ((ze_get_vip_flags(id) & VIP_A) && (ze_get_vip_flags(id) & VIP_E))
  52.         {
  53.             client_print(id,print_chat,"%s You have just received 150 free %s being a [VIP++] since %s passed !",TAG,txt_coins,txt_min);
  54.             ze_set_escape_coins(id, ze_get_escape_coins(id) + 150);  
  55.             nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
  56.             return;
  57.         }
  58.         else if (ze_get_vip_flags(id) & VIP_A)
  59.         {
  60.             client_print(id,print_chat,"%s You have just received 100 free %s being a [VIP+] since %s passed !",TAG,txt_coins,txt_min);
  61.             ze_set_escape_coins(id, ze_get_escape_coins(id) + 100);  
  62.             nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
  63.             return;
  64.         }
  65.         else
  66.         {
  67.             client_print(id,print_chat,"%s You have just received %d %s since %s passed ! [VIP] get an extra 100-150 coins!",TAG,coins,txt_coins,txt_min);
  68.             ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);
  69.             nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
  70.             return;
  71.         }
  72.     }
  73.     if ((ze_get_vip_flags(id) & VIP_A) && (ze_get_vip_flags(id) & VIP_E))
  74.         {
  75.             client_print(id,print_chat,"%s Retry again in %s to get 150 more %s !",TAG,txt_min,txt_coins);
  76.             return;
  77.         }
  78.         else if(ze_get_vip_flags(id) & VIP_A)
  79.         {
  80.             client_print(id,print_chat,"%s Retry again in %s to get 100 more %s !",TAG,txt_min,txt_coins);
  81.             return;
  82.         }
  83.         else
  84.         {
  85.        
  86.             client_print(id,print_chat,"%s Retry again in %s to get %d more %s !",TAG,txt_min,coins,txt_coins);
  87.         }
  88.     nvault_close(nv);
  89.     return;
  90. }

Re: ze_get_vip_flags

Posted: 26 Aug 2018, 08:54
by Raheem
It should be called in case of first and second cases failed, i'm not sure but if second one called this means because you have flag a. Try make sure you don't have any flag then try.