Page 1 of 1

Escapes Count converted to Nvault problem.

Posted: 24 Oct 2019, 12:13
by neverminddw
Someone able to tell me where the problem is here?

Error:

Code: Select all

L 10/24/2019 - 08:09:26: [AMXX] Plugin ("ze_escapes_count.amxx") is setting itself as failed.
L 10/24/2019 - 08:09:26: [AMXX] Run time error 1 (plugin "ze_escapes_count.amxx") - forced exit
Source:
  1. #include <zombie_escape>
  2.  
  3. #define TASK_SHOWHUD 2020
  4. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  5.  
  6. // Static (Change it if you need)
  7. new const g_szEscapesVault[] = "Escapes"
  8.  
  9. // Variables
  10. new g_iEscapes[33],
  11.     g_iEscapesVaultHandle,
  12.     g_MsgSync
  13.     //Handle:g_hTuple,
  14.  
  15. // Natives
  16. public plugin_natives()
  17. {
  18.     register_native("ze_get_user_escapes", "native_ze_get_user_escapes", 1)
  19.     register_native("ze_set_user_escapes", "native_ze_set_user_escapes", 1)
  20. }
  21.  
  22. public plugin_init()
  23. {
  24.     register_plugin("Escapes Count", "1.0", "Nevermind")
  25.    
  26.     // Hud Message
  27.     g_MsgSync = CreateHudSyncObj()
  28. }
  29.  
  30. public client_putinserver(id)
  31. {
  32.     if (is_user_bot(id) || is_user_hltv(id))
  33.         return
  34.    
  35.     // Just 1 second delay
  36.     set_task(1.0, "DelayLoad", id)
  37.    
  38.     set_task(1.5, "Show_Escapes", id+TASK_SHOWHUD, _, _, "b") // show escapes
  39. }
  40.  
  41. public DelayLoad(id)
  42. {
  43.     LoadEscapes(id)
  44. }
  45.  
  46. /*public plugin_end()
  47. {
  48.     if (g_hTuple != Empty_Handle)
  49.     {
  50.         SQL_FreeHandle(g_hTuple)
  51.     }
  52. }*/
  53.  
  54. public Show_Escapes(taskid)
  55. {  
  56.     new iPlayer = ID_SHOWHUD
  57.    
  58.     if (!is_user_alive(iPlayer))
  59.     {
  60.         iPlayer = pev(iPlayer, pev_iuser2)
  61.        
  62.         if (!is_user_alive(iPlayer))
  63.             return
  64.     }
  65.    
  66.     if(iPlayer != ID_SHOWHUD)
  67.     {
  68.         set_hudmessage(42, 255, 0, 0.72, 0.05, 0, 6.0, 1.1, 0.0, 0.0, -1)
  69.         ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Escapes: %d", g_iEscapes[ID_SHOWHUD])
  70.     }
  71. }
  72.  
  73. public ze_roundend(WinTeam)
  74. {
  75.     if (WinTeam == ZE_TEAM_HUMAN)
  76.     {
  77.         for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  78.         {
  79.             if (!is_user_alive(id) || ze_is_user_zombie(id))
  80.                 continue
  81.  
  82.             g_iEscapes[id] ++
  83.             SaveEscapes(id)
  84.         }
  85.     }
  86. }
  87.  
  88. LoadEscapes(id)
  89. {
  90.     new szData[256], szAuthID[35]
  91.    
  92.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  93.    
  94.     // Useless Variable
  95.     new iTimestamp, iExists
  96.    
  97.     // Open the Vault
  98.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  99.    
  100.     iExists = nvault_lookup(g_iEscapesVaultHandle, szAuthID, szData, charsmax(szData), iTimestamp)
  101.    
  102.     // Close Vault
  103.     nvault_close(g_iEscapesVaultHandle)
  104.    
  105.     if (!iExists)
  106.     {
  107.         g_iEscapes[id] = 0
  108.         SaveEscapes(id)
  109.     }
  110.     else
  111.     {
  112.         new iEscapes[32]
  113.         parse(szData, iEscapes, 31)
  114.        
  115.         g_iEscapes[id] = str_to_num(iEscapes)
  116.     }
  117. }
  118.  
  119. SaveEscapes(id)
  120. {
  121.     new szAuthID[35], szName[32]
  122.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  123.     get_user_name(id, szName, charsmax(szName))
  124.    
  125.     new szData[256]
  126.     formatex(szData, charsmax(szData), "%i", g_iEscapes[id])
  127.    
  128.     // Open the Vaults
  129.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  130.  
  131.     // Saves His Data
  132.     nvault_set(g_iEscapesVaultHandle, szAuthID, szData)
  133.  
  134.     // Close Vaults
  135.     nvault_close(g_iEscapesVaultHandle)
  136. }
  137.  
  138. // Natives
  139. public native_ze_get_user_escapes(id)
  140. {
  141.     if (!is_user_connected(id))
  142.     {
  143.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  144.         return false
  145.     }
  146.    
  147.     return g_iEscapes[id]
  148. }
  149.  
  150. public native_ze_set_user_escapes(id, iAmount)
  151. {
  152.     if (!is_user_connected(id))
  153.     {
  154.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  155.         return false
  156.     }
  157.    
  158.     g_iEscapes[id] = iAmount
  159.     SaveEscapes(id)
  160.     return true
  161. }

Re: Escapes Count converted to Nvault problem.

Posted: 24 Oct 2019, 18:26
by snitch
neverminddw wrote: 4 years ago Someone able to tell me where the problem is here?

Error:

Code: Select all

L 10/24/2019 - 08:09:26: [AMXX] Plugin ("ze_escapes_count.amxx") is setting itself as failed.
L 10/24/2019 - 08:09:26: [AMXX] Run time error 1 (plugin "ze_escapes_count.amxx") - forced exit
Source:
  1. #include <zombie_escape>
  2.  
  3. #define TASK_SHOWHUD 2020
  4. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  5.  
  6. // Static (Change it if you need)
  7. new const g_szEscapesVault[] = "Escapes"
  8.  
  9. // Variables
  10. new g_iEscapes[33],
  11.     g_iEscapesVaultHandle,
  12.     g_MsgSync
  13.     //Handle:g_hTuple,
  14.  
  15. // Natives
  16. public plugin_natives()
  17. {
  18.     register_native("ze_get_user_escapes", "native_ze_get_user_escapes", 1)
  19.     register_native("ze_set_user_escapes", "native_ze_set_user_escapes", 1)
  20. }
  21.  
  22. public plugin_init()
  23. {
  24.     register_plugin("Escapes Count", "1.0", "Nevermind")
  25.    
  26.     // Hud Message
  27.     g_MsgSync = CreateHudSyncObj()
  28. }
  29.  
  30. public client_putinserver(id)
  31. {
  32.     if (is_user_bot(id) || is_user_hltv(id))
  33.         return
  34.    
  35.     // Just 1 second delay
  36.     set_task(1.0, "DelayLoad", id)
  37.    
  38.     set_task(1.5, "Show_Escapes", id+TASK_SHOWHUD, _, _, "b") // show escapes
  39. }
  40.  
  41. public DelayLoad(id)
  42. {
  43.     LoadEscapes(id)
  44. }
  45.  
  46. /*public plugin_end()
  47. {
  48.     if (g_hTuple != Empty_Handle)
  49.     {
  50.         SQL_FreeHandle(g_hTuple)
  51.     }
  52. }*/
  53.  
  54. public Show_Escapes(taskid)
  55. {  
  56.     new iPlayer = ID_SHOWHUD
  57.    
  58.     if (!is_user_alive(iPlayer))
  59.     {
  60.         iPlayer = pev(iPlayer, pev_iuser2)
  61.        
  62.         if (!is_user_alive(iPlayer))
  63.             return
  64.     }
  65.    
  66.     if(iPlayer != ID_SHOWHUD)
  67.     {
  68.         set_hudmessage(42, 255, 0, 0.72, 0.05, 0, 6.0, 1.1, 0.0, 0.0, -1)
  69.         ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Escapes: %d", g_iEscapes[ID_SHOWHUD])
  70.     }
  71. }
  72.  
  73. public ze_roundend(WinTeam)
  74. {
  75.     if (WinTeam == ZE_TEAM_HUMAN)
  76.     {
  77.         for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  78.         {
  79.             if (!is_user_alive(id) || ze_is_user_zombie(id))
  80.                 continue
  81.  
  82.             g_iEscapes[id] ++
  83.             SaveEscapes(id)
  84.         }
  85.     }
  86. }
  87.  
  88. LoadEscapes(id)
  89. {
  90.     new szData[256], szAuthID[35]
  91.    
  92.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  93.    
  94.     // Useless Variable
  95.     new iTimestamp, iExists
  96.    
  97.     // Open the Vault
  98.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  99.    
  100.     iExists = nvault_lookup(g_iEscapesVaultHandle, szAuthID, szData, charsmax(szData), iTimestamp)
  101.    
  102.     // Close Vault
  103.     nvault_close(g_iEscapesVaultHandle)
  104.    
  105.     if (!iExists)
  106.     {
  107.         g_iEscapes[id] = 0
  108.         SaveEscapes(id)
  109.     }
  110.     else
  111.     {
  112.         new iEscapes[32]
  113.         parse(szData, iEscapes, 31)
  114.        
  115.         g_iEscapes[id] = str_to_num(iEscapes)
  116.     }
  117. }
  118.  
  119. SaveEscapes(id)
  120. {
  121.     new szAuthID[35], szName[32]
  122.     get_user_authid(id, szAuthID, charsmax(szAuthID))
  123.     get_user_name(id, szName, charsmax(szName))
  124.    
  125.     new szData[256]
  126.     formatex(szData, charsmax(szData), "%i", g_iEscapes[id])
  127.    
  128.     // Open the Vaults
  129.     g_iEscapesVaultHandle = nvault_open(g_szEscapesVault)
  130.  
  131.     // Saves His Data
  132.     nvault_set(g_iEscapesVaultHandle, szAuthID, szData)
  133.  
  134.     // Close Vaults
  135.     nvault_close(g_iEscapesVaultHandle)
  136. }
  137.  
  138. // Natives
  139. public native_ze_get_user_escapes(id)
  140. {
  141.     if (!is_user_connected(id))
  142.     {
  143.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  144.         return false
  145.     }
  146.    
  147.     return g_iEscapes[id]
  148. }
  149.  
  150. public native_ze_set_user_escapes(id, iAmount)
  151. {
  152.     if (!is_user_connected(id))
  153.     {
  154.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  155.         return false
  156.     }
  157.    
  158.     g_iEscapes[id] = iAmount
  159.     SaveEscapes(id)
  160.     return true
  161. }
add debug
and give us more info logs

Re: Escapes Count converted to Nvault problem.

Posted: 24 Oct 2019, 19:12
by neverminddw
There is only 1 log. Those 2 lines up there that I already wrote.

Tho, I'm waiting for Mohamed Alaa or Raheem to help me out with this. The original author of this plugin is Mohamed, I only converted it from MySQL to nVault, and added Hud Message "Escapes: %d". For more info check out the code.

Thanks again.

Re: Escapes Count converted to Nvault problem.

Posted: 10 Nov 2019, 14:54
by Raheem
Should work, any more logs? What caused this i think maybe native that not activated.