Approved Infects (MySQL)

Plug-ins compatibility with Zombie Escape 1.x only!


Post Reply
karan
Mod Tester
Mod Tester
India
Posts: 122
Joined: 6 years ago
Location: India
Contact:

#11

Post by karan » 2 years ago

  1. #include <zombie_escape>
  2.  
  3.  
  4. // Static (Change it if you need)
  5. new const g_szEscapesVault[] = "Escapes"
  6.  
  7. // Variables
  8. new g_iEscapes[33],
  9.     g_iEscapesVaultHandle
  10.  
  11.  
  12. // Natives
  13. public plugin_natives()
  14. {
  15.     register_native("ze_get_user_escapes", "native_ze_get_user_escapes", 1)
  16.     register_native("ze_set_user_escapes", "native_ze_set_user_escapes", 1)
  17. }
  18.  
  19. public plugin_init()
  20. {
  21.     register_plugin("Escapes Count", "1.0", "ze-dev-team")
  22. }
  23.  
  24. public client_putinserver(id)
  25. {
  26.     if (is_user_bot(id) || is_user_hltv(id))
  27.         return
  28.    
  29.     // Just 1 second delay
  30.     set_task(1.0, "DelayLoad", id)
  31. }
  32.  
  33. public DelayLoad(id)
  34. {
  35.     LoadEscapes(id)
  36. }
  37.  
  38. public ze_roundend(WinTeam)
  39. {
  40.     if (WinTeam == ZE_TEAM_HUMAN)
  41.     {
  42.         for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  43.         {
  44.             if (!is_user_alive(id) || ze_is_user_zombie(id))
  45.                 continue
  46.  
  47.             g_iEscapes[id] ++
  48.             SaveEscapes(id)
  49.         }
  50.     }
  51. }
  52.  
  53. LoadEscapes(id)
  54. {
  55.     new szData[256], szAuthID[35]
  56.    
  57.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  58.    
  59.     // Useless Variable
  60.     new iTimestamp, iExists
  61.    
  62.     // Open the Vault
  63.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  64.    
  65.     iExists = nvault_lookup(g_iEscapesVaultHandle, szAuthID, szData, charsmax(szData), iTimestamp)
  66.    
  67.     // Close Vault
  68.     nvault_close(g_iEscapesVaultHandle)
  69.    
  70.     if (!iExists)
  71.     {
  72.         g_iEscapes[id] = 0
  73.         SaveEscapes(id)
  74.     }
  75.     else
  76.     {
  77.         new iEscapes[32]
  78.         parse(szData, iEscapes, 31)
  79.        
  80.         g_iEscapes[id] = str_to_num(iEscapes)
  81.     }
  82. }
  83.  
  84. SaveEscapes(id)
  85. {
  86.     new szAuthID[35], szName[32]
  87.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  88.     get_user_name(id, szName, charsmax(szName))
  89.    
  90.     new szData[256]
  91.     formatex(szData, charsmax(szData), "%i", g_iEscapes[id])
  92.    
  93.     // Open the Vaults
  94.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  95.  
  96.     // Saves His Data
  97.     nvault_set(g_iEscapesVaultHandle, szAuthID, szData)
  98.  
  99.     // Close Vaults
  100.     nvault_close(g_iEscapesVaultHandle)
  101. }
  102.  
  103. // Natives
  104. public native_ze_get_user_escapes(id)
  105. {
  106.     if (!is_user_connected(id))
  107.     {
  108.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  109.         return false
  110.     }
  111.    
  112.     return g_iEscapes[id]
  113. }
  114.  
  115. public native_ze_set_user_escapes(id, iAmount)
  116. {
  117.     if (!is_user_connected(id))
  118.     {
  119.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  120.         return false
  121.     }
  122.    
  123.     g_iEscapes[id] = iAmount
  124.     SaveEscapes(id)
  125.     return true
  126. }
Image

karan
Mod Tester
Mod Tester
India
Posts: 122
Joined: 6 years ago
Location: India
Contact:

#12

Post by karan » 2 years ago

try them use raheem's edited hud to see infects & escapes viewtopic.php?f=7&t=3563
Image

User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

#13

Post by VicKy » 2 years ago

:twisted:
karan wrote: 2 years ago
  1. #include <zombie_escape>
  2.  
  3.  
  4. // Static (Change it if you need)
  5. new const g_szEscapesVault[] = "Escapes"
  6.  
  7. // Variables
  8. new g_iEscapes[33],
  9.     g_iEscapesVaultHandle
  10.  
  11.  
  12. // Natives
  13. public plugin_natives()
  14. {
  15.     register_native("ze_get_user_escapes", "native_ze_get_user_escapes", 1)
  16.     register_native("ze_set_user_escapes", "native_ze_set_user_escapes", 1)
  17. }
  18.  
  19. public plugin_init()
  20. {
  21.     register_plugin("Escapes Count", "1.0", "ze-dev-team")
  22. }
  23.  
  24. public client_putinserver(id)
  25. {
  26.     if (is_user_bot(id) || is_user_hltv(id))
  27.         return
  28.    
  29.     // Just 1 second delay
  30.     set_task(1.0, "DelayLoad", id)
  31. }
  32.  
  33. public DelayLoad(id)
  34. {
  35.     LoadEscapes(id)
  36. }
  37.  
  38. public ze_roundend(WinTeam)
  39. {
  40.     if (WinTeam == ZE_TEAM_HUMAN)
  41.     {
  42.         for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  43.         {
  44.             if (!is_user_alive(id) || ze_is_user_zombie(id))
  45.                 continue
  46.  
  47.             g_iEscapes[id] ++
  48.             SaveEscapes(id)
  49.         }
  50.     }
  51. }
  52.  
  53. LoadEscapes(id)
  54. {
  55.     new szData[256], szAuthID[35]
  56.    
  57.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  58.    
  59.     // Useless Variable
  60.     new iTimestamp, iExists
  61.    
  62.     // Open the Vault
  63.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  64.    
  65.     iExists = nvault_lookup(g_iEscapesVaultHandle, szAuthID, szData, charsmax(szData), iTimestamp)
  66.    
  67.     // Close Vault
  68.     nvault_close(g_iEscapesVaultHandle)
  69.    
  70.     if (!iExists)
  71.     {
  72.         g_iEscapes[id] = 0
  73.         SaveEscapes(id)
  74.     }
  75.     else
  76.     {
  77.         new iEscapes[32]
  78.         parse(szData, iEscapes, 31)
  79.        
  80.         g_iEscapes[id] = str_to_num(iEscapes)
  81.     }
  82. }
  83.  
  84. SaveEscapes(id)
  85. {
  86.     new szAuthID[35], szName[32]
  87.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  88.     get_user_name(id, szName, charsmax(szName))
  89.    
  90.     new szData[256]
  91.     formatex(szData, charsmax(szData), "%i", g_iEscapes[id])
  92.    
  93.     // Open the Vaults
  94.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  95.  
  96.     // Saves His Data
  97.     nvault_set(g_iEscapesVaultHandle, szAuthID, szData)
  98.  
  99.     // Close Vaults
  100.     nvault_close(g_iEscapesVaultHandle)
  101. }
  102.  
  103. // Natives
  104. public native_ze_get_user_escapes(id)
  105. {
  106.     if (!is_user_connected(id))
  107.     {
  108.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  109.         return false
  110.     }
  111.    
  112.     return g_iEscapes[id]
  113. }
  114.  
  115. public native_ze_set_user_escapes(id, iAmount)
  116. {
  117.     if (!is_user_connected(id))
  118.     {
  119.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  120.         return false
  121.     }
  122.    
  123.     g_iEscapes[id] = iAmount
  124.     SaveEscapes(id)
  125.     return true
  126. }
Thanks Bro it Fixed But Now I Am Using MySQL Both Are Working
Image

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