Approved Buy VIP

Gameplay Addons
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1720
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

Buy VIP

#1

Post by Raheem » 4 Months Ago

Buy VIP by Escape Coins

Description:
  • This plugin will allow players to buy VIP membership for 1 or 2 weeks only. Pleayers can buy it with their escape coins.
Cvars:
  • one_week_vip_price 25000 Price for one week VIP membership.
  • two_week_vip_price 40000 Price for two weeks VIP membership.
  • buy_vip_flags "abcde" Flags to give to player who buy this VIP.
  • auto_update_setinfo 1 Auto update setinfo _pw for player to the new password he written? 1 = Yes | 2 = No
Commands:
  • say /buy_vip or say_team /buy_vip Show player a menu to buy VIP from.
Natives:
  • ze_open_buy_vip_menu(id) Open buy vip menu for id.
Installation & Instructions:
  • Simply install it like any plugin.
  • Make sure VIP system installed: viewtopic.php?f=15&t=39 (Latest version).
  • All vips will be made using SteamID.
  • If player is VIP he will not be able to use buy vip menu.
  • Player must write password, empty password will not be accepted.
  • If player bought vip during round, he must wait next round and it will be auto loaded.

Screenshots:
  • 1.png
    2.png
    3.png
Downloads:
These users thanked the author Raheem for the post:
DarkZombie (4 Months Ago)
You don't know? Learn and you will know.

User avatar
SexY DeviL CJ
Mod Tester
Mod Tester
Posts: 73
Joined: 1 Year Ago
Has thanked: 1 time
Been thanked: 10 times
Contact:

#2

Post by SexY DeviL CJ » 4 Months Ago

Nice. I will test it

[ Post made via Android ]
......Devil Was Here......

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 5 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#3

Post by Mark » 4 Months Ago

Raheem wrote:
4 Months Ago
Buy VIP by Escape Coins

Description:
  • This plugin will allow players to buy VIP membership for 1 or 2 weeks only. Pleayers can buy it with their escape coins.
Cvars:
  • one_week_vip_price 25000 Price for one week VIP membership.
  • two_week_vip_price 40000 Price for two weeks VIP membership.
  • buy_vip_flags "abcde" Flags to give to player who buy this VIP.
  • auto_update_setinfo 1 Auto update setinfo _pw for player to the new password he written? 1 = Yes | 2 = No
Commands:
  • say /buy_vip or say_team /buy_vip Show player a menu to buy VIP from.
Natives:
  • ze_open_buy_vip_menu(id) Open buy vip menu for id.
Installation & Instructions:
  • Simply install it like any plugin.
  • Make sure VIP system installed: viewtopic.php?f=15&t=39 (Latest version).
  • All vips will be made using SteamID.
  • If player is VIP he will not be able to use buy vip menu.
  • Player must write password, empty password will not be accepted.
  • If player bought vip during round, he must wait next round and it will be auto loaded.

Screenshots:
  • 1.png2.png3.png
Downloads:
  • [ZE] Buy VIP.zip
I did fix the other one from other author but forgot to post it :D

User avatar
th3_king
VIP
VIP
Egypt
Posts: 29
Joined: 1 Year Ago
Location: Egypt
Has thanked: 9 times
Been thanked: 2 times
Age: 16
Contact:

#4

Post by th3_king » 4 Months Ago

Good Job :smiley:
Join Our Server
Image

Zjox
Member
Member
Austria
Posts: 23
Joined: 3 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#5

Post by Zjox » 3 Months Ago

Hello,
I want to make small edit in this plugin adding comment in ze_vips.ini when Player buy VIP between it's account
add comma with his name ; Player Name at last.
So how can i do this? where i can edit this
It's amazing plugin really thanks @Raheem You are the best.
Just need you to tell me where to edit and what to edit, Thanks!

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1720
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#6

Post by Raheem » 3 Months Ago

Here it's but it will not be useful as player can change his name and you will not know him anymore:

  1. #include <zombie_escape>
  2. #include <ze_vip>
  3.  
  4. // Const.
  5. static const g_szLocalFile[] = "addons/amxmodx/configs/ze_vips.ini"
  6.  
  7. // CVARs
  8. new g_pCvarOneWeekPrice,
  9.     g_pCvarTwoWeekPrice,
  10.     g_pCvarVIPFlags,
  11.     g_pCvarAutoUpdatePW
  12.  
  13. // Variables
  14. new g_iOneOrTwo, Array:g_aBought;
  15.  
  16. public plugin_natives()
  17. {
  18.     register_native("ze_open_buy_vip_menu", "native_ze_open_buy_vip_menu", 1)
  19. }
  20.  
  21. public plugin_init()
  22. {
  23.     register_plugin("Buy VIP", "1.0", "Raheem")
  24.    
  25.     // Commands
  26.     register_clcmd("say /buy_vip", "ShowBuyVIPMenu")
  27.     register_clcmd("say_team /buy_vip", "ShowBuyVIPMenu")
  28.     register_clcmd("Enter_Password", "cmdEnterPassword")
  29.    
  30.     // CVARs
  31.     g_pCvarOneWeekPrice = register_cvar("one_week_vip_price", "25000")
  32.     g_pCvarTwoWeekPrice = register_cvar("two_week_vip_price", "40000")
  33.     g_pCvarVIPFlags = register_cvar("buy_vip_flags", "abcde")
  34.     g_pCvarAutoUpdatePW = register_cvar("auto_update_setinfo", "1")
  35.    
  36.     // Create dynamic arrays
  37.     g_aBought = ArrayCreate(34)
  38. }
  39.  
  40. public native_ze_open_buy_vip_menu(id)
  41. {
  42.     ShowBuyVIPMenu(id)
  43. }
  44.  
  45. public ze_game_started()
  46. {
  47.     ArrayClear(g_aBought)
  48. }
  49.  
  50. public ShowBuyVIPMenu(id)
  51. {
  52.     if (!is_user_connected(id))
  53.         return PLUGIN_CONTINUE
  54.  
  55.     if (IsPlayerInArray(g_aBought, id))
  56.     {
  57.         client_print_color(id, print_team_default, "^3You will be VIP next round^1, ^3please be patient^1!")
  58.         return PLUGIN_HANDLED
  59.     }
  60.  
  61.     if (ze_is_user_vip(id))
  62.     {
  63.         client_print_color(id, print_team_default, "^3You are already VIP^1!")
  64.         return PLUGIN_HANDLED
  65.     }
  66.    
  67.     new iMenu = menu_create("\rChoose V.I.P Plan\w:", "BuyVIP_Menu_Handler")
  68.    
  69.     new iPlayerEC
  70.     iPlayerEC = ze_get_escape_coins(id)
  71.    
  72.     new szItemText[128]
  73.    
  74.     if (iPlayerEC >= get_pcvar_num(g_pCvarOneWeekPrice))
  75.     {
  76.         formatex(szItemText, charsmax(szItemText), "\yOne Week \w- \r%i", get_pcvar_num(g_pCvarOneWeekPrice))
  77.         menu_additem(iMenu, szItemText, "", 0)
  78.     }
  79.     else
  80.     {
  81.         formatex(szItemText, charsmax(szItemText), "\dOne Week - \r%i", get_pcvar_num(g_pCvarOneWeekPrice))
  82.         menu_additem(iMenu, szItemText, "", 0)
  83.     }
  84.    
  85.     if (iPlayerEC >= get_pcvar_num(g_pCvarTwoWeekPrice))
  86.     {
  87.         formatex(szItemText, charsmax(szItemText), "\yTwo Weeks \w- \r%i^n^n\rNOTE: Your VIP will be saved with SteamID.", get_pcvar_num(g_pCvarTwoWeekPrice))
  88.         menu_additem(iMenu, szItemText, "", 0)
  89.     }
  90.     else
  91.     {
  92.         formatex(szItemText, charsmax(szItemText), "\dTwo Weeks - \r%i^n^n\rNOTE: Your VIP will be saved with SteamID.", get_pcvar_num(g_pCvarTwoWeekPrice))
  93.         menu_additem(iMenu, szItemText, "", 0)
  94.     }
  95.    
  96.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  97.     menu_display(id, iMenu, 0)
  98.    
  99.     return PLUGIN_CONTINUE
  100. }
  101.  
  102. public BuyVIP_Menu_Handler(id, iMenu, iItem)
  103. {
  104.     if(!is_user_connected(id) || ze_is_user_vip(id))
  105.         return PLUGIN_HANDLED
  106.    
  107.     new iPlayerEC
  108.     iPlayerEC = ze_get_escape_coins(id)
  109.        
  110.     switch(iItem)
  111.     {
  112.         case 0:
  113.         {
  114.             if (iPlayerEC >= get_pcvar_num(g_pCvarOneWeekPrice))
  115.             {
  116.                 client_cmd(id, "messagemode Enter_Password")
  117.                 g_iOneOrTwo = 1;
  118.             }
  119.             else
  120.             {
  121.                 client_print_color(id, print_team_red, "^3WARNING^1: ^4Insufficient Funds^1!")
  122.                 PlaySound(id, "vox/warning.wav")
  123.             }
  124.         }
  125.         case 1:
  126.         {
  127.             if (iPlayerEC >= get_pcvar_num(g_pCvarTwoWeekPrice))
  128.             {
  129.                 client_cmd(id, "messagemode Enter_Password")
  130.                 g_iOneOrTwo = 2;
  131.             }
  132.             else
  133.             {
  134.                 client_print_color(id, print_team_red, "^3WARNING^1: ^4Insufficient Funds^1!")
  135.                 PlaySound(id, "vox/warning.wav")
  136.             }
  137.         }
  138.     }
  139.  
  140.     menu_destroy(iMenu)
  141.     return PLUGIN_HANDLED
  142. }
  143.  
  144. public cmdEnterPassword(id)
  145. {
  146.     new szPassword[32]
  147.     read_args(szPassword, charsmax(szPassword))
  148.     remove_quotes(szPassword)
  149.    
  150.     if (strlen(szPassword) <= 0)
  151.     {
  152.         client_print_color(id, print_team_red, "^3ERROR^1: ^4You can't use empty password^1!")
  153.         return
  154.     }
  155.    
  156.     new szAuthId[34], szName[32]
  157.     get_user_authid(id, szAuthId, charsmax(szAuthId))
  158.     get_user_name(id, szName, charsmax(szName))
  159.    
  160.     new szFlags[30]
  161.     get_pcvar_string(g_pCvarVIPFlags, szFlags, charsmax(szFlags))
  162.    
  163.     new szExpireDate[16]
  164.    
  165.     if (g_iOneOrTwo == 1)
  166.     {
  167.         get_date(7, szExpireDate, charsmax(szExpireDate))
  168.     }
  169.     else if (g_iOneOrTwo == 2)
  170.     {
  171.         get_date(14, szExpireDate, charsmax(szExpireDate))
  172.     }
  173.    
  174.     // Format line to be added to ze_vips.ini
  175.     new szAddLine[128], iFileHandler
  176.    
  177.     formatex(szAddLine, charsmax(szAddLine), "^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ;%s", szAuthId, szPassword, szFlags, szExpireDate, szName)
  178.    
  179.     iFileHandler = fopen(g_szLocalFile, "at")
  180.     fputs(iFileHandler, szAddLine)
  181.     fclose(iFileHandler)
  182.    
  183.     if (get_pcvar_num(g_pCvarAutoUpdatePW) == 1)
  184.     {
  185.         new szFormatPW[64]
  186.         formatex(szFormatPW, charsmax(szFormatPW), "setinfo _pw ^"%s^"", szPassword)
  187.        
  188.         Send_Cmd(id, szFormatPW)
  189.     }
  190.    
  191.     client_print_color(id, print_team_default, "^3Successfully bought^1, ^3your VIP will expire in^1: ^4%s^1!", szExpireDate)
  192.    
  193.     if (g_iOneOrTwo == 1)
  194.     {
  195.         ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvarOneWeekPrice))
  196.     }
  197.     else if (g_iOneOrTwo == 2)
  198.     {
  199.         ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvarTwoWeekPrice))
  200.     }
  201.    
  202.     ArrayPushString(g_aBought, szAuthId)
  203. }
  204.  
  205. // Not written by me
  206. stock get_date(days, string[], chars)
  207. {
  208.     new y, m, d
  209.     date(y, m ,d)
  210.    
  211.     d+=days
  212.    
  213.     new go = true
  214.     while(go) {
  215.         switch(m) {
  216.             case 1,3, 5, 7, 8, 10: {
  217.                 if(d>31) { d=d-31; m++; }
  218.                 else go = false
  219.             }
  220.             case 2: {
  221.                 if(d>28) { d=d-28; m++; }
  222.                 else go = false
  223.             }
  224.             case 4, 6, 9, 11: {
  225.                 if(d>30) { d=d-30; m++; }
  226.                 else go = false
  227.             }
  228.             case 12: {
  229.                 if(d>31) { d=d-31; y++; m=1; }
  230.                 else go = false
  231.             }
  232.         }
  233.     }
  234.    
  235.     formatex(string, chars, "%d-%d-%d", d, m, y)
  236. }
  237.  
  238. // Useful slow hacking to auto set pw for users
  239. stock Send_Cmd(id, szCmd[])
  240. {
  241.     message_begin(MSG_ONE, 51, _, id)
  242.     write_byte(strlen(szCmd) + 2)
  243.     write_byte(10)
  244.     write_string(szCmd)
  245.     message_end()
  246. }
  247.  
  248. // Check if player steamid in given array or not
  249. stock IsPlayerInArray(Array:aSteamArray, id)
  250. {
  251.     new szAuthId[34], szSavedAuthId[34];
  252.    
  253.     get_user_authid(id, szAuthId, charsmax(szAuthId))
  254.    
  255.     for(new i = 0; i < ArraySize(aSteamArray); i++)
  256.     {
  257.         ArrayGetString(aSteamArray, i, szSavedAuthId, charsmax(szSavedAuthId))
  258.        
  259.         if (equal(szSavedAuthId, szAuthId))
  260.         {
  261.             return true
  262.         }
  263.     }
  264.    
  265.     return false
  266. }
You don't know? Learn and you will know.

Zjox
Member
Member
Austria
Posts: 23
Joined: 3 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#7

Post by Zjox » 3 Months Ago

Hello,
It's not compiling
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// cbuy_vip.sma
//
// G:\ZE Sources\scripting\cbuy_vip.sma(26) : warning 217: loose indentation
// G:\ZE Sources\scripting\cbuy_vip.sma(29) : warning 217: loose indentation
// G:\ZE Sources\scripting\cbuy_vip.sma(248) : error 021: symbol already defined: "IsPlayerInArray"
//
// 1 Error.
// Could not locate output file G:\ZE Sources\scripting\compiled\cbuy_vip.amx (compile failed).
//
// Compilation Time: 1.28 sec
// ----------------------------------------

Press enter to exit ...

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 534
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 19
Contact:

#8

Post by Jack GamePlay » 3 Months Ago

Zjox wrote:
3 Months Ago
Hello,
It's not compiling
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// cbuy_vip.sma
//
// G:\ZE Sources\scripting\cbuy_vip.sma(26) : warning 217: loose indentation
// G:\ZE Sources\scripting\cbuy_vip.sma(29) : warning 217: loose indentation
// G:\ZE Sources\scripting\cbuy_vip.sma(248) : error 021: symbol already defined: "IsPlayerInArray"
//
// 1 Error.
// Could not locate output file G:\ZE Sources\scripting\compiled\cbuy_vip.amx (compile failed).
//
// Compilation Time: 1.28 sec
// ----------------------------------------

Press enter to exit ...
Download zombie_escape_stocks.inc from github.
We update any problems to the github before releasing a new version.

[ Post made via Android ]
Image

Zjox
Member
Member
Austria
Posts: 23
Joined: 3 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#9

Post by Zjox » 3 Months Ago

Jack GamePlay wrote:
3 Months Ago
Zjox wrote:
3 Months Ago
Hello,
It's not compiling
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// cbuy_vip.sma
//
// G:\ZE Sources\scripting\cbuy_vip.sma(26) : warning 217: loose indentation
// G:\ZE Sources\scripting\cbuy_vip.sma(29) : warning 217: loose indentation
// G:\ZE Sources\scripting\cbuy_vip.sma(248) : error 021: symbol already defined: "IsPlayerInArray"
//
// 1 Error.
// Could not locate output file G:\ZE Sources\scripting\compiled\cbuy_vip.amx (compile failed).
//
// Compilation Time: 1.28 sec
// ----------------------------------------

Press enter to exit ...
Download zombie_escape_stocks.inc from github.
We update any problems to the github before releasing a new version.
Hey,
Same problem...

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1720
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#10

Post by Raheem » 3 Months Ago

You are using GitHub latest stocks include and in it the IsPlayerInArray() function already defined so no need again to be defined in code, this what the error tells:
    1. #include <zombie_escape>
    2. #include <ze_vip>
    3.  
    4. // Const.
    5. static const g_szLocalFile[] = "addons/amxmodx/configs/ze_vips.ini"
    6.  
    7. // CVARs
    8. new g_pCvarOneWeekPrice,
    9.     g_pCvarTwoWeekPrice,
    10.     g_pCvarVIPFlags,
    11.     g_pCvarAutoUpdatePW
    12.  
    13. // Variables
    14. new g_iOneOrTwo, Array:g_aBought;
    15.  
    16. public plugin_natives()
    17. {
    18.     register_native("ze_open_buy_vip_menu", "native_ze_open_buy_vip_menu", 1)
    19. }
    20.  
    21. public plugin_init()
    22. {
    23.     register_plugin("Buy VIP", "1.0", "Raheem")
    24.    
    25.     // Commands
    26.     register_clcmd("say /buy_vip", "ShowBuyVIPMenu")
    27.     register_clcmd("say_team /buy_vip", "ShowBuyVIPMenu")
    28.     register_clcmd("Enter_Password", "cmdEnterPassword")
    29.    
    30.     // CVARs
    31.     g_pCvarOneWeekPrice = register_cvar("one_week_vip_price", "25000")
    32.     g_pCvarTwoWeekPrice = register_cvar("two_week_vip_price", "40000")
    33.     g_pCvarVIPFlags = register_cvar("buy_vip_flags", "abcde")
    34.     g_pCvarAutoUpdatePW = register_cvar("auto_update_setinfo", "1")
    35.    
    36.     // Create dynamic arrays
    37.     g_aBought = ArrayCreate(34)
    38. }
    39.  
    40. public native_ze_open_buy_vip_menu(id)
    41. {
    42.     ShowBuyVIPMenu(id)
    43. }
    44.  
    45. public ze_game_started()
    46. {
    47.     ArrayClear(g_aBought)
    48. }
    49.  
    50. public ShowBuyVIPMenu(id)
    51. {
    52.     if (!is_user_connected(id))
    53.         return PLUGIN_CONTINUE
    54.  
    55.     if (IsPlayerInArray(g_aBought, id))
    56.     {
    57.         client_print_color(id, print_team_default, "^3You will be VIP next round^1, ^3please be patient^1!")
    58.         return PLUGIN_HANDLED
    59.     }
    60.  
    61.     if (ze_is_user_vip(id))
    62.     {
    63.         client_print_color(id, print_team_default, "^3You are already VIP^1!")
    64.         return PLUGIN_HANDLED
    65.     }
    66.    
    67.     new iMenu = menu_create("\rChoose V.I.P Plan\w:", "BuyVIP_Menu_Handler")
    68.    
    69.     new iPlayerEC
    70.     iPlayerEC = ze_get_escape_coins(id)
    71.    
    72.     new szItemText[128]
    73.    
    74.     if (iPlayerEC >= get_pcvar_num(g_pCvarOneWeekPrice))
    75.     {
    76.         formatex(szItemText, charsmax(szItemText), "\yOne Week \w- \r%i", get_pcvar_num(g_pCvarOneWeekPrice))
    77.         menu_additem(iMenu, szItemText, "", 0)
    78.     }
    79.     else
    80.     {
    81.         formatex(szItemText, charsmax(szItemText), "\dOne Week - \r%i", get_pcvar_num(g_pCvarOneWeekPrice))
    82.         menu_additem(iMenu, szItemText, "", 0)
    83.     }
    84.    
    85.     if (iPlayerEC >= get_pcvar_num(g_pCvarTwoWeekPrice))
    86.     {
    87.         formatex(szItemText, charsmax(szItemText), "\yTwo Weeks \w- \r%i^n^n\rNOTE: Your VIP will be saved with SteamID.", get_pcvar_num(g_pCvarTwoWeekPrice))
    88.         menu_additem(iMenu, szItemText, "", 0)
    89.     }
    90.     else
    91.     {
    92.         formatex(szItemText, charsmax(szItemText), "\dTwo Weeks - \r%i^n^n\rNOTE: Your VIP will be saved with SteamID.", get_pcvar_num(g_pCvarTwoWeekPrice))
    93.         menu_additem(iMenu, szItemText, "", 0)
    94.     }
    95.    
    96.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
    97.     menu_display(id, iMenu, 0)
    98.    
    99.     return PLUGIN_CONTINUE
    100. }
    101.  
    102. public BuyVIP_Menu_Handler(id, iMenu, iItem)
    103. {
    104.     if(!is_user_connected(id) || ze_is_user_vip(id))
    105.         return PLUGIN_HANDLED
    106.    
    107.     new iPlayerEC
    108.     iPlayerEC = ze_get_escape_coins(id)
    109.        
    110.     switch(iItem)
    111.     {
    112.         case 0:
    113.         {
    114.             if (iPlayerEC >= get_pcvar_num(g_pCvarOneWeekPrice))
    115.             {
    116.                 client_cmd(id, "messagemode Enter_Password")
    117.                 g_iOneOrTwo = 1;
    118.             }
    119.             else
    120.             {
    121.                 client_print_color(id, print_team_red, "^3WARNING^1: ^4Insufficient Funds^1!")
    122.                 PlaySound(id, "vox/warning.wav")
    123.             }
    124.         }
    125.         case 1:
    126.         {
    127.             if (iPlayerEC >= get_pcvar_num(g_pCvarTwoWeekPrice))
    128.             {
    129.                 client_cmd(id, "messagemode Enter_Password")
    130.                 g_iOneOrTwo = 2;
    131.             }
    132.             else
    133.             {
    134.                 client_print_color(id, print_team_red, "^3WARNING^1: ^4Insufficient Funds^1!")
    135.                 PlaySound(id, "vox/warning.wav")
    136.             }
    137.         }
    138.     }
    139.  
    140.     menu_destroy(iMenu)
    141.     return PLUGIN_HANDLED
    142. }
    143.  
    144. public cmdEnterPassword(id)
    145. {
    146.     new szPassword[32]
    147.     read_args(szPassword, charsmax(szPassword))
    148.     remove_quotes(szPassword)
    149.    
    150.     if (strlen(szPassword) <= 0)
    151.     {
    152.         client_print_color(id, print_team_red, "^3ERROR^1: ^4You can't use empty password^1!")
    153.         return
    154.     }
    155.    
    156.     new szAuthId[34], szName[32]
    157.     get_user_authid(id, szAuthId, charsmax(szAuthId))
    158.     get_user_name(id, szName, charsmax(szName))
    159.    
    160.     new szFlags[30]
    161.     get_pcvar_string(g_pCvarVIPFlags, szFlags, charsmax(szFlags))
    162.    
    163.     new szExpireDate[16]
    164.    
    165.     if (g_iOneOrTwo == 1)
    166.     {
    167.         get_date(7, szExpireDate, charsmax(szExpireDate))
    168.     }
    169.     else if (g_iOneOrTwo == 2)
    170.     {
    171.         get_date(14, szExpireDate, charsmax(szExpireDate))
    172.     }
    173.    
    174.     // Format line to be added to ze_vips.ini
    175.     new szAddLine[128], iFileHandler
    176.    
    177.     formatex(szAddLine, charsmax(szAddLine), "^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ;%s", szAuthId, szPassword, szFlags, szExpireDate, szName)
    178.    
    179.     iFileHandler = fopen(g_szLocalFile, "at")
    180.     fputs(iFileHandler, szAddLine)
    181.     fclose(iFileHandler)
    182.    
    183.     if (get_pcvar_num(g_pCvarAutoUpdatePW) == 1)
    184.     {
    185.         new szFormatPW[64]
    186.         formatex(szFormatPW, charsmax(szFormatPW), "setinfo _pw ^"%s^"", szPassword)
    187.        
    188.         Send_Cmd(id, szFormatPW)
    189.     }
    190.    
    191.     client_print_color(id, print_team_default, "^3Successfully bought^1, ^3your VIP will expire in^1: ^4%s^1!", szExpireDate)
    192.    
    193.     if (g_iOneOrTwo == 1)
    194.     {
    195.         ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvarOneWeekPrice))
    196.     }
    197.     else if (g_iOneOrTwo == 2)
    198.     {
    199.         ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvarTwoWeekPrice))
    200.     }
    201.    
    202.     ArrayPushString(g_aBought, szAuthId)
    203. }
    204.  
    205. // Not written by me
    206. stock get_date(days, string[], chars)
    207. {
    208.     new y, m, d
    209.     date(y, m ,d)
    210.    
    211.     d+=days
    212.    
    213.     new go = true
    214.     while(go) {
    215.         switch(m) {
    216.             case 1,3, 5, 7, 8, 10: {
    217.                 if(d>31) { d=d-31; m++; }
    218.                 else go = false
    219.             }
    220.             case 2: {
    221.                 if(d>28) { d=d-28; m++; }
    222.                 else go = false
    223.             }
    224.             case 4, 6, 9, 11: {
    225.                 if(d>30) { d=d-30; m++; }
    226.                 else go = false
    227.             }
    228.             case 12: {
    229.                 if(d>31) { d=d-31; y++; m=1; }
    230.                 else go = false
    231.             }
    232.         }
    233.     }
    234.    
    235.     formatex(string, chars, "%d-%d-%d", d, m, y)
    236. }
    237.  
    238. // Useful slow hacking to auto set pw for users
    239. stock Send_Cmd(id, szCmd[])
    240. {
    241.     message_begin(MSG_ONE, 51, _, id)
    242.     write_byte(strlen(szCmd) + 2)
    243.     write_byte(10)
    244.     write_string(szCmd)
    245.     message_end()
    246. }
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest