Advertisement
Hyuna

Buy Admin v1.0 by Hyuna

Jun 2nd, 2016
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.43 KB | None | 0 0
  1. /*
  2.     AMX Mod X Plugin: Buy Admin
  3.     Copyright (C) 2016  Hyuna aka NorToN
  4.  
  5.     This program is free software: you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation, either version 3 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. */
  18.  
  19. #include <amxmodx>
  20.  
  21. #if !defined MAX_PLAYERS
  22.     #define MAX_PLAYERS 32
  23. #endif
  24.  
  25. #define semicolon 1
  26.  
  27. enum _:AdminData
  28. {
  29.     aName[32],
  30.     aCost
  31. }
  32.  
  33. enum _:cData
  34. {
  35.     cAcc,
  36.     cTime
  37. }
  38.  
  39. #define cSkype "skypename"
  40. #define cSteam "steamname"
  41. #define cPhone "phonenumber"
  42.  
  43. #define MAX_BUY 5
  44. #define MAX_TIME 12
  45.  
  46. #define PAYCALL
  47.  
  48. #if defined PAYCALL
  49. new const Float:g_fPayCallOffset = 1.2;
  50. #endif
  51.  
  52. new const g_aAdminData[MAX_BUY][AdminData] = {
  53.     { "VIP", 10 },
  54.     { "Admin", 30 },
  55.     { "Super Admin", 50 },
  56.     { "Manager", 70 },
  57.     { "Owner", 99 }
  58. };
  59.  
  60. new g_bCounter[MAX_PLAYERS + 1][cData];
  61.  
  62. public plugin_init() {
  63.     register_plugin("Buy Admin","v1.0","Hyuna");
  64.    
  65.     register_saycmd("buyadmin","ActionBuyAdmin");
  66. }
  67.  
  68. public client_connect(client) {
  69.     g_bCounter[client][cAcc] = 0;
  70.     g_bCounter[client][cTime] = 0;
  71. }
  72.  
  73. public ActionBuyAdmin(client) {
  74.     static some[256], iMenu, iCallBack;
  75.     iMenu = menu_create("Buy Admin","mHandler");
  76.     iCallBack = menu_makecallback("mCallBack");
  77.    
  78.     formatex(some,charsmax(some),"Access Type: \d[ \r%s \d]",g_aAdminData[g_bCounter[client][cAcc]][aName]);
  79.     menu_additem(iMenu,some);
  80.    
  81.     formatex(some,charsmax(some),"Time: \d[ \r%d Month%s \d]",(g_bCounter[client][cTime] + 1),(g_bCounter[client][cTime] == 0 ? "":"s"));
  82.     menu_additem(iMenu,some);
  83.    
  84.     formatex(some,charsmax(some),"Cost: \d[ \r%d \yNIS \d]",(g_aAdminData[g_bCounter[client][cAcc]][aCost] * (g_bCounter[client][cTime] + 1)));
  85.     menu_additem(iMenu,some,.callback=iCallBack);
  86.    
  87.     #if defined PAYCALL
  88.     formatex(some,charsmax(some),"PayCall Cost: \d[ \r%d \yNIS \d]",floatround((g_aAdminData[g_bCounter[client][cAcc]][aCost] * (g_bCounter[client][cTime] + 1)) * g_fPayCallOffset));
  89.     menu_additem(iMenu,some,.callback=iCallBack);
  90.     #endif
  91.    
  92.     formatex(some,charsmax(some),"Phone: %s^nSteam: %s^nSkype: %s",cPhone,cSteam,cSkype);
  93.     menu_addtext(iMenu,some);
  94.    
  95.     menu_display(client,iMenu);
  96.    
  97.     return PLUGIN_HANDLED;
  98. }
  99.  
  100. public mCallBack(client, menu, item) {
  101.     return ITEM_DISABLED;
  102. }
  103.  
  104. public mHandler(client, menu, item) {
  105.     switch (item)
  106.     {
  107.         case 0:
  108.         {
  109.             if (++g_bCounter[client][cAcc] == MAX_BUY)
  110.                 g_bCounter[client][cAcc] = 0;
  111.         }
  112.            
  113.         case 1:
  114.         {
  115.             if (++g_bCounter[client][cTime] == MAX_TIME)
  116.                 g_bCounter[client][cTime] = 0;
  117.         }
  118.        
  119.         case MENU_EXIT:
  120.         {
  121.             menu_destroy(menu);
  122.             return PLUGIN_HANDLED;
  123.         }
  124.     }
  125.    
  126.     menu_destroy(menu);
  127.     return ActionBuyAdmin(client);
  128. }
  129.  
  130. stock register_saycmd(const cmd[], const function[]) {
  131.     static const cmdsay[][] = { "say", "say_team" };
  132.     static const marks[] = { '!', '/', '.' };
  133.     static some[64], i, j;
  134.    
  135.     for (i = 0; i < 2; i++)
  136.     {
  137.         for (j = 0; j < 3; j++)
  138.         {
  139.             formatex(some,charsmax(some),"%s %c%s",cmdsay[i],marks[j],cmd);
  140.             register_clcmd(some,function);
  141.         }
  142.     }
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement