Solved Buy Vip Menu

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:

Buy Vip Menu

#1

Post by Mark » 5 years ago

is this possible tried a few things can't figure it out

Im trying to show extra information that will call the expire and cost.
  1.  public BuyVipMenu( id )
  2.  {
  3.     new vipMenu = menu_create( "\rBuy VIP^n^n Cost: %s ^m Expires: %s", "menu_handler", get_pcvar_num(VIP_Cost), sdate);
  4.    
  5.     menu_additem( vipMenu, "\wBuy Vip with escape coins!", "", 0 );
  6.  
  7.     menu_setprop( vipMenu, MPROP_EXIT, MEXIT_ALL );
  8.     menu_display( id, vipMenu, 0 );
  9.  
  10.  }

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

#2

Post by Raheem » 5 years ago

We format text and save it in a variable then display it in our menu:
    1. new szTitle[128]
    2.  
    3. formatex(szTitle, charsmax(szTitle), "\rBuy VIP^n^n Cost: %i ^n Expires: %s", get_pcvar_num(VIP_Cost), sdate)
    4.  
    5. new iVIPMenu
    6.  
    7. iVIPMenu = menu_create(szTitle, "Menu_Handler")
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 We format text and save it in a variable then display it in our menu:
    1. new szTitle[128]
    2.  
    3. formatex(szTitle, charsmax(szTitle), "\rBuy VIP^n^n Cost: %i ^n Expires: %s", get_pcvar_num(VIP_Cost), sdate)
    4.  
    5. new iVIPMenu
    6.  
    7. iVIPMenu = menu_create(szTitle, "Menu_Handler")
Umm so like this? did not work explain more :D
  1.  public BuyVipMenu( id )
  2.  {
  3.     new szTitle[128]
  4.  
  5.     formatex(szTitle, charsmax(szTitle), "\rBuy VIP^n^n Cost: %i ^n Expires: %s", get_pcvar_num(VIP_Cost), sdate)
  6.  
  7.     new vipMenu = menu_create(szTitle, "Menu_Handler");
  8.    
  9.     menu_additem( vipMenu, "\yPurchase Vip++!\w", "", 0 );
  10.  
  11.     menu_setprop( vipMenu, MPROP_EXIT, MEXIT_ALL );
  12.     menu_display( id, vipMenu, 0 );
  13.  
  14.  }

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

#4

Post by Raheem » 5 years ago

What this variable contain: sdate?

Also let me know what the problem now. It's not compiling or it's not showing right in game? give more information.
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:

#5

Post by Mark » 5 years ago

Menu won't open in game
  1. get_date(get_pcvar_num(g_vip_buy_time), sdate, charsmax(sdate))

  1. stock get_date(days, string[], chars) {
  2.    
  3.     new y, m, d
  4.     date(y, m ,d)
  5.    
  6.     d+=days
  7.    
  8.     new go = true
  9.     while(go) {
  10.         switch(m) {
  11.             case 1,3, 5, 7, 8, 10: {
  12.                 if(d>31) { d=d-31; m++; }
  13.                 else go = false
  14.             }
  15.             case 2: {
  16.                 if(d>28) { d=d-28; m++; }
  17.                 else go = false
  18.             }
  19.             case 4, 6, 9, 11: {
  20.                 if(d>30) { d=d-30; m++; }
  21.                 else go = false
  22.             }
  23.             case 12: {
  24.                 if(d>31) { d=d-31; y++; m=1; }
  25.                 else go = false
  26.             }
  27.         }
  28.     }
  29.     formatex(string, chars, "%d-%d-%d", m, d ,y)
  30. }

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

#6

Post by Mark » 5 years ago

RapidFlush wrote: 5 years ago Menu won't open in game
  1. get_date(get_pcvar_num(g_vip_buy_time), sdate, charsmax(sdate))

  1. stock get_date(days, string[], chars) {
  2.    
  3.     new y, m, d
  4.     date(y, m ,d)
  5.    
  6.     d+=days
  7.    
  8.     new go = true
  9.     while(go) {
  10.         switch(m) {
  11.             case 1,3, 5, 7, 8, 10: {
  12.                 if(d>31) { d=d-31; m++; }
  13.                 else go = false
  14.             }
  15.             case 2: {
  16.                 if(d>28) { d=d-28; m++; }
  17.                 else go = false
  18.             }
  19.             case 4, 6, 9, 11: {
  20.                 if(d>30) { d=d-30; m++; }
  21.                 else go = false
  22.             }
  23.             case 12: {
  24.                 if(d>31) { d=d-31; y++; m=1; }
  25.                 else go = false
  26.             }
  27.         }
  28.     }
  29.     formatex(string, chars, "%d-%d-%d", m, d ,y)
  30. }
Even if i take sdate out it still does not work :D

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

#7

Post by Raheem » 5 years ago

Menu is showing or not?
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:

#8

Post by Mark » 5 years ago

Raheem im sorry friend i made a mistype with spelling it seems to be working now thanks!

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

#9

Post by Raheem » 5 years ago

:flushed: :joy:
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:

#10

Post by Mark » 5 years ago

Raheem wrote: 5 years ago:flushed: :joy:
:lol: :lol: :lol:

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 7 guests