Solved ze_get_vip_flags

Coding Help/Re-API Supported
Post Reply
User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

ze_get_vip_flags

#1

Post by Mark » 5 years ago

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.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 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"))
He who fails to plan is planning to fail

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#3

Post by Mark » 5 years ago

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. }

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 5 years ago

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.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests