hlmod.hu
https://hlmod.hu/

Átalakítónál hibát mutat a plugin
https://hlmod.hu/viewtopic.php?f=9&t=5293
Oldal: 1 / 2

Szerző:  Bence98007 [2012.07.17. 15:27 ]
Hozzászólás témája:  Átalakítónál hibát mutat a plugin

Üdv.!

Írtam egy plugint és eszt tobja átalakításnál:
Kód:
  1. //tmp/textU5HvTJ.sma(90) : error 018: initialization data exceeds declared size

  2. /tmp/textU5HvTJ.sma(165) : error 018: initialization data exceeds declared size

  3. /tmp/textU5HvTJ.sma(196) : warning 217: loose indentation

  4. /tmp/textU5HvTJ.sma(199) : warning 217: loose indentation

  5. /tmp/textU5HvTJ.sma(211) : warning 217: loose indentation

  6. /tmp/textU5HvTJ.sma(218) : warning 217: loose indentation

  7. /tmp/textU5HvTJ.sma(220) : warning 204: symbol is assigned a value that is never used: "iVictim"

  8. /tmp/textU5HvTJ.sma(220) : warning 209: function "eDeath" should return a value


SMA:
Kód:
  1. /*****************************

  2.  

  3. Pluign: XP Mód

  4. Készítő: Bence98007

  5. Verzió: 1.0

  6.  

  7.  

  8. ******************************/

  9. #include <amxmodx>

  10. #include <amxmisc>

  11. #include <nvault>

  12.  

  13. #define MAXSZINT 69

  14.  

  15.  

  16. new PlayerXP[33],PlayerLevel[33],PlayerClass[33]

  17. new xp_kill,xp_kes,xp_hs,xp_mentes

  18. new g_vault

  19.  

  20. new const CLASSES[MAXSZINT][] = {

  21.    

  22.         "Private",

  23.         "Private I",

  24.         "Private II",

  25.         "Private First Class",

  26.         "Private First Class I",

  27.         "Private First Class II",

  28.         "Specialist",

  29.         "Specialist I",

  30.         "Specialist II",

  31.         "Corporal",

  32.         "Corporal I",

  33.         "Corporal II",

  34.         "Sergeant",

  35.         "Sergeant I",

  36.         "Sergeant II",

  37.         "Staff Sergeant",

  38.         "Staff Sergeant I",

  39.         "Staff Sergeant II",

  40.         "Sergeant First Class",

  41.         "Sergeant First Class I",

  42.         "Sergeant First Class II",

  43.         "Master Sergeant",

  44.         "Master Sergeant I",

  45.         "Master Sergeant II",

  46.         "First Sergeant",

  47.         "First Sergeant I",

  48.         "First Sergeant II",

  49.         "Sergeant Major",

  50.         "Sergeant Major I",

  51.         "Sergeant Major II",

  52.         "Command Sergeant Major",

  53.         "Command Sergeant Major I",

  54.         "Command Sergeant Major II",

  55.         "2nd Lieutenant",

  56.         "2nd Lieutenant I",

  57.         "2nd Lieutenant II",

  58.         "1st Lieutenant",

  59.         "1st Lieutenant I",

  60.         "1st Lieutenant II",

  61.         "Captain",

  62.         "Captain I",

  63.         "Captain II",

  64.         "Major",

  65.         "Major I",

  66.         "Major II",

  67.         "Lieutenant Colonel",

  68.         "Lieutenant Colonel I",

  69.         "Lieutenant Colonel II",

  70.         "Lieutenant Colonel III",

  71.         "Colonel",

  72.         "Colonel I",

  73.         "Colonel II",

  74.         "Colonel III",

  75.         "Brigadier General",

  76.         "Brigadier General I",

  77.         "Brigadier General II",

  78.         "Brigadier General III",

  79.         "Major General",

  80.         "Major General I",

  81.         "Major General II",

  82.         "Major General III",

  83.         "Lieutenant General",

  84.         "Lieutenant General I",

  85.         "Lieutenant General II",

  86.         "Lieutenant General III",

  87.         "General",

  88.         "General I",

  89.         "General II",

  90.         "General III",

  91.         "Commander"

  92. }

  93.  

  94.  

  95. new const LEVELS[7] = {

  96. 0,

  97. 100,

  98. 300,

  99. 500,

  100. 700,

  101. 900,

  102. 1100,

  103. 1300,

  104. 1500,

  105. 1700,

  106. 1900,

  107. 2100,

  108. 2300,

  109. 2500,

  110. 2700,

  111. 2900,

  112. 3100,

  113. 3300,

  114. 3500,

  115. 3700,

  116. 3900,

  117. 4100,

  118. 4300,

  119. 4500,

  120. 4700,

  121. 4900,

  122. 5100,

  123. 5300,

  124. 5500,

  125. 5700,

  126. 5900,

  127. 6100,

  128. 6300,

  129. 6500,

  130. 6700,

  131. 6900,

  132. 6100,

  133. 7300,

  134. 7500,

  135. 7700,

  136. 7900,

  137. 8100,

  138. 8300,

  139. 8500,

  140. 8700,

  141. 8900,

  142. 9100,

  143. 9300,

  144. 9500,

  145. 9700,

  146. 9900,

  147. 10100,

  148. 11300,

  149. 11500,

  150. 11700,

  151. 11900,

  152. 12100,

  153. 12300,

  154. 12500,

  155. 12700,

  156. 12900,

  157. 13100,

  158. 13300,

  159. 13500,

  160. 13700,

  161. 13900,

  162. 14000,

  163.  

  164.  

  165. }

  166.  

  167. public plugin_init()

  168. {

  169.     register_plugin("XP-mod", "1.0", "Bence98007")

  170.  

  171.     register_event("DeathMsg", "eDeath", "a")

  172.  

  173.     xp_mentes = register_cvar("xpmentes","1")

  174.  

  175.     xp_kill=register_cvar("XP_kill", "20")

  176.  

  177.     xp_hs=register_cvar("XP_hs","22")

  178.  

  179.     xp_kes=register_cvar("XP_kes","30")

  180.  

  181.     g_vault = nvault_open("xpmod")

  182.  

  183.     register_clcmd("say /xp", "ShowHud")

  184.     register_clcmd("say_team /xp", "ShowHud")

  185. }

  186.  

  187. public eDeath()

  188. {

  189.  

  190.     new attacker = read_data( 1 )

  191.  

  192.     new iVictim = read_data( 2 )

  193.  

  194.     new headshot = read_data( 3 )

  195.  

  196.      if(PlayerClass[attacker] == 0)

  197.          return PLUGIN_CONTINUE

  198.  

  199.     new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);

  200.  

  201.     PlayerXP[attacker] += get_pcvar_num(xp_kill)

  202.  

  203.    

  204.     if(headshot)

  205.         PlayerXP[attacker] += get_pcvar_num(xp_hs)

  206.  

  207.     if(weapon == CSW_KNIFE)

  208.         PlayerXP[attacker] += get_pcvar_num(xp_kes)

  209.  

  210.        

  211.      while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])

  212.     {  

  213.         client_print(attacker, print_chat, "[XP-Mod] Grat! Szinted: %i Rangod: %s !", PlayerLevel[attacker],CLASSES[PlayerClass[attacker]])

  214.      

  215.         PlayerLevel[attacker] += 1

  216.     }

  217.  

  218.     ShowHud(attacker)

  219.  

  220. }

  221.  

  222.  

  223.  

  224. public ShowHud(id)

  225. {

  226.     set_hudmessage(85, 255, 0, 0.01, 0.90, 0, 6.0, 12.0)

  227.     show_hudmessage(id, "[Szinted] %i [XP]: %i [Rangod] %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])

  228. }

  229.  

  230.  

  231.  

  232. public client_connect(id)

  233. {

  234.     if(get_pcvar_num(xp_mentes) == 1)

  235.     {

  236.         LoadData(id)

  237.     }

  238. }

  239.  

  240. public client_disconnect(id)

  241. {

  242.      if(get_pcvar_num(xp_mentes) == 1)

  243.      {

  244.           SaveData(id)

  245.      }

  246. }

  247.  

  248.  

  249. public SaveData(id)

  250. {

  251.     new name[32]

  252.     get_user_name(id, name, 31)

  253.  

  254.     new vaultkey[64],vaultdata[256]

  255.    

  256.     format(vaultkey,63,"%sXPmod", name)

  257.    

  258.     format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])

  259.  

  260.    

  261.  

  262.     nvault_set(g_vault,vaultkey,vaultdata)

  263.     return PLUGIN_CONTINUE

  264. }

  265.  

  266.  

  267. public LoadData(id)

  268. {

  269.     new name[32]

  270.     get_user_name(id, name, 31)

  271.     new vaultkey[64],vaultdata[256]

  272.    

  273.     format(vaultkey,63,"%sXPmod", name)

  274.     format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])

  275.    

  276.     nvault_get(g_vault,vaultkey,vaultdata,255)

  277.     replace_all(vaultdata, 255, "#", " ")

  278.    

  279.     new playerxp[32], playerlevel[32]

  280.     parse(vaultdata, playerxp, 31, playerlevel, 31)

  281.    

  282.     PlayerXP[id] = str_to_num(playerxp)

  283.     PlayerLevel[id] = str_to_num(playerlevel)

  284.    

  285.     return PLUGIN_CONTINUE

  286. }  

  287.  

  288.  


Valaki javítaná nekem benne a hibá(ka)t?
Köszönöm!

Szerző:  CrB [2012.07.17. 15:31 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

tessék remélem észrevehető amit javítottam ha nem és érdekelne szólj :)
Kód:
/*****************************
 
Pluign: XP Mód
Készítő: Bence98007
Verzió: 1.0
 
 
******************************/
#include <amxmodx>
#include <amxmisc>
#include <nvault>
 
#define MAXSZINT 70
 
 
new PlayerXP[33],PlayerLevel[33],PlayerClass[33]
new xp_kill,xp_kes,xp_hs,xp_mentes
new g_vault
 
new const CLASSES[MAXSZINT][] = {
   
        "Private",
        "Private I",
        "Private II",
        "Private First Class",
        "Private First Class I",
        "Private First Class II",
        "Specialist",
        "Specialist I",
        "Specialist II",
        "Corporal",
        "Corporal I",
        "Corporal II",
        "Sergeant",
        "Sergeant I",
        "Sergeant II",
        "Staff Sergeant",
        "Staff Sergeant I",
        "Staff Sergeant II",
        "Sergeant First Class",
        "Sergeant First Class I",
        "Sergeant First Class II",
        "Master Sergeant",
        "Master Sergeant I",
        "Master Sergeant II",
        "First Sergeant",
        "First Sergeant I",
        "First Sergeant II",
        "Sergeant Major",
        "Sergeant Major I",
        "Sergeant Major II",
        "Command Sergeant Major",
        "Command Sergeant Major I",
        "Command Sergeant Major II",
        "2nd Lieutenant",
        "2nd Lieutenant I",
        "2nd Lieutenant II",
        "1st Lieutenant",
        "1st Lieutenant I",
        "1st Lieutenant II",
        "Captain",
        "Captain I",
        "Captain II",
        "Major",
        "Major I",
        "Major II",
        "Lieutenant Colonel",
        "Lieutenant Colonel I",
        "Lieutenant Colonel II",
        "Lieutenant Colonel III",
        "Colonel",
        "Colonel I",
        "Colonel II",
        "Colonel III",
        "Brigadier General",
        "Brigadier General I",
        "Brigadier General II",
        "Brigadier General III",
        "Major General",
        "Major General I",
        "Major General II",
        "Major General III",
        "Lieutenant General",
        "Lieutenant General I",
        "Lieutenant General II",
        "Lieutenant General III",
        "General",
        "General I",
        "General II",
        "General III",
        "Commander"
}
 
 
new const LEVELS[67] = {
0,
100,
300,
500,
700,
900,
1100,
1300,
1500,
1700,
1900,
2100,
2300,
2500,
2700,
2900,
3100,
3300,
3500,
3700,
3900,
4100,
4300,
4500,
4700,
4900,
5100,
5300,
5500,
5700,
5900,
6100,
6300,
6500,
6700,
6900,
6100,
7300,
7500,
7700,
7900,
8100,
8300,
8500,
8700,
8900,
9100,
9300,
9500,
9700,
9900,
10100,
11300,
11500,
11700,
11900,
12100,
12300,
12500,
12700,
12900,
13100,
13300,
13500,
13700,
13900,
14000
}
 
public plugin_init()
{
    register_plugin("XP-mod", "1.0", "Bence98007")
 
    register_event("DeathMsg", "eDeath", "a")
 
    xp_mentes = register_cvar("xpmentes","1")
 
    xp_kill=register_cvar("XP_kill", "20")
 
    xp_hs=register_cvar("XP_hs","22")
 
    xp_kes=register_cvar("XP_kes","30")
 
    g_vault = nvault_open("xpmod")
 
    register_clcmd("say /xp", "ShowHud")
    register_clcmd("say_team /xp", "ShowHud")
}
 
public eDeath()
{
 
    new attacker = read_data( 1 )
 
    new iVictim = read_data( 2 )
 
    new headshot = read_data( 3 )
 
     if(PlayerClass[attacker] == 0)
         return PLUGIN_CONTINUE
 
    new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);
 
    PlayerXP[attacker] += get_pcvar_num(xp_kill)
 
   
    if(headshot)
        PlayerXP[attacker] += get_pcvar_num(xp_hs)
 
    if(weapon == CSW_KNIFE)
        PlayerXP[attacker] += get_pcvar_num(xp_kes)
 
       
     while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    { 
        client_print(attacker, print_chat, "[XP-Mod] Grat! Szinted: %i Rangod: %s !", PlayerLevel[attacker],CLASSES[PlayerClass[attacker]])
     
        PlayerLevel[attacker] += 1
    }
 
    ShowHud(attacker)
 
}
 
 
 
public ShowHud(id)
{
    set_hudmessage(85, 255, 0, 0.01, 0.90, 0, 6.0, 12.0)
    show_hudmessage(id, "[Szinted] %i [XP]: %i [Rangod] %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])
}
 
 
 
public client_connect(id)
{
    if(get_pcvar_num(xp_mentes) == 1)
    {
        LoadData(id)
    }
}
 
public client_disconnect(id)
{
     if(get_pcvar_num(xp_mentes) == 1)
     {
          SaveData(id)
     }
}
 
 
public SaveData(id)
{
    new name[32]
    get_user_name(id, name, 31)
 
    new vaultkey[64],vaultdata[256]
   
    format(vaultkey,63,"%sXPmod", name)
   
    format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
 
   
 
    nvault_set(g_vault,vaultkey,vaultdata)
    return PLUGIN_CONTINUE
}
 
 
public LoadData(id)
{
    new name[32]
    get_user_name(id, name, 31)
    new vaultkey[64],vaultdata[256]
   
    format(vaultkey,63,"%sXPmod", name)
    format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
   
    nvault_get(g_vault,vaultkey,vaultdata,255)
    replace_all(vaultdata, 255, "#", " ")
   
    new playerxp[32], playerlevel[32]
    parse(vaultdata, playerxp, 31, playerlevel, 31)
   
    PlayerXP[id] = str_to_num(playerxp)
    PlayerLevel[id] = str_to_num(playerlevel)
   
    return PLUGIN_CONTINUE

 

Szerző:  Bence98007 [2012.07.17. 17:35 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Köszönöm! Remélem jó! Majd szólok ha rossz!

**EDIT:**
Errort dob:

Kód:
  1. files/8324608/8324608.sma(194) : warning 217: loose indentation

  2. files/8324608/8324608.sma(197) : warning 217: loose indentation

  3. files/8324608/8324608.sma(209) : warning 217: loose indentation

  4. files/8324608/8324608.sma(216) : warning 217: loose indentation

  5. files/8324608/8324608.sma(218) : warning 204: symbol is assigned a value that is never used: "iVictim"

  6. files/8324608/8324608.sma(218) : warning 209: function "eDeath" should return a value

de legalább átalakítja!

Szerző:  kiki [2012.07.17. 17:59 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Warning, errort nem latok! Amm nem te írtad látni rajta:D

Szerző:  Bence98007 [2012.07.17. 18:09 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Én írtam, aszem Silent, vagy Virtual tutorialjából! Szal sukk van!

Szerző:  GhostRyder [2012.07.17. 18:18 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Silent tutorialja, de akkor nem te írtad... Csak átírtad úgy ahogy neked kell...

Szerző:  Bence98007 [2012.07.17. 18:20 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Hú de nem érdekel! Akkor beleírom a nevét h ne sírjatok nekem -.-"

Nem tudom mi a hiba...valaki segítsen!

Szerző:  Silent [2012.07.17. 18:42 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Egyik sem para, mind csak "indentation" és "should"... Szóval kód nem hibás.

Szerző:  Bence98007 [2012.07.17. 21:53 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

De nem viszi a szeró a plugint! semmi! meg se jelenik! rendesen bele van írva a plugins.ini

Szerző:  Silent [2012.07.18. 09:51 ]
Hozzászólás témája:  Re: Átalakítónál hibát mutat a plugin

Kód:
  1. #include <amxmodx>

  2. #include <amxmisc>

  3. #include <nvault>

  4.  

  5. #define MAXSZINT 70

  6.  

  7.  

  8. new PlayerXP[33],PlayerLevel[33],PlayerClass[33]

  9. new xp_kill,xp_kes,xp_hs,xp_mentes

  10. new g_vault

  11.  

  12. new const CLASSES[MAXSZINT][] = {

  13.    

  14.         "Private",

  15.         "Private I",

  16.         "Private II",

  17.         "Private First Class",

  18.         "Private First Class I",

  19.         "Private First Class II",

  20.         "Specialist",

  21.         "Specialist I",

  22.         "Specialist II",

  23.         "Corporal",

  24.         "Corporal I",

  25.         "Corporal II",

  26.         "Sergeant",

  27.         "Sergeant I",

  28.         "Sergeant II",

  29.         "Staff Sergeant",

  30.         "Staff Sergeant I",

  31.         "Staff Sergeant II",

  32.         "Sergeant First Class",

  33.         "Sergeant First Class I",

  34.         "Sergeant First Class II",

  35.         "Master Sergeant",

  36.         "Master Sergeant I",

  37.         "Master Sergeant II",

  38.         "First Sergeant",

  39.         "First Sergeant I",

  40.         "First Sergeant II",

  41.         "Sergeant Major",

  42.         "Sergeant Major I",

  43.         "Sergeant Major II",

  44.         "Command Sergeant Major",

  45.         "Command Sergeant Major I",

  46.         "Command Sergeant Major II",

  47.         "2nd Lieutenant",

  48.         "2nd Lieutenant I",

  49.         "2nd Lieutenant II",

  50.         "1st Lieutenant",

  51.         "1st Lieutenant I",

  52.         "1st Lieutenant II",

  53.         "Captain",

  54.         "Captain I",

  55.         "Captain II",

  56.         "Major",

  57.         "Major I",

  58.         "Major II",

  59.         "Lieutenant Colonel",

  60.         "Lieutenant Colonel I",

  61.         "Lieutenant Colonel II",

  62.         "Lieutenant Colonel III",

  63.         "Colonel",

  64.         "Colonel I",

  65.         "Colonel II",

  66.         "Colonel III",

  67.         "Brigadier General",

  68.         "Brigadier General I",

  69.         "Brigadier General II",

  70.         "Brigadier General III",

  71.         "Major General",

  72.         "Major General I",

  73.         "Major General II",

  74.         "Major General III",

  75.         "Lieutenant General",

  76.         "Lieutenant General I",

  77.         "Lieutenant General II",

  78.         "Lieutenant General III",

  79.         "General",

  80.         "General I",

  81.         "General II",

  82.         "General III",

  83.         "Commander"

  84. }

  85.  

  86.  

  87. new const LEVELS[] = {

  88. 0,

  89. 100,

  90. 300,

  91. 500,

  92. 700,

  93. 900,

  94. 1100,

  95. 1300,

  96. 1500,

  97. 1700,

  98. 1900,

  99. 2100,

  100. 2300,

  101. 2500,

  102. 2700,

  103. 2900,

  104. 3100,

  105. 3300,

  106. 3500,

  107. 3700,

  108. 3900,

  109. 4100,

  110. 4300,

  111. 4500,

  112. 4700,

  113. 4900,

  114. 5100,

  115. 5300,

  116. 5500,

  117. 5700,

  118. 5900,

  119. 6100,

  120. 6300,

  121. 6500,

  122. 6700,

  123. 6900,

  124. 6100,

  125. 7300,

  126. 7500,

  127. 7700,

  128. 7900,

  129. 8100,

  130. 8300,

  131. 8500,

  132. 8700,

  133. 8900,

  134. 9100,

  135. 9300,

  136. 9500,

  137. 9700,

  138. 9900,

  139. 10100,

  140. 11300,

  141. 11500,

  142. 11700,

  143. 11900,

  144. 12100,

  145. 12300,

  146. 12500,

  147. 12700,

  148. 12900,

  149. 13100,

  150. 13300,

  151. 13500,

  152. 13700,

  153. 13900,

  154. 14000,

  155.  

  156.  

  157. }

  158.  

  159. public plugin_init()

  160. {

  161.     register_plugin("XP-mod", "1.0", "Bence98007")

  162.  

  163.     register_event("DeathMsg", "eDeath", "a")

  164.  

  165.     xp_mentes = register_cvar("xpmentes","1")

  166.  

  167.     xp_kill=register_cvar("XP_kill", "20")

  168.  

  169.     xp_hs=register_cvar("XP_hs","22")

  170.  

  171.     xp_kes=register_cvar("XP_kes","30")

  172.  

  173.     g_vault = nvault_open("xpmod")

  174.  

  175.     register_clcmd("say /xp", "ShowHud")

  176.     register_clcmd("say_team /xp", "ShowHud")

  177. }

  178.  

  179. public eDeath()

  180. {

  181.  

  182.         new attacker = read_data( 1 )

  183.  

  184.         new headshot = read_data( 3 )

  185.  

  186.         if(PlayerClass[attacker] == 0)

  187.         return PLUGIN_CONTINUE

  188.  

  189.         new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);

  190.  

  191.         PlayerXP[attacker] += get_pcvar_num(xp_kill)

  192.  

  193.    

  194.         if(headshot)

  195.         PlayerXP[attacker] += get_pcvar_num(xp_hs)

  196.  

  197.         if(weapon == CSW_KNIFE)

  198.         PlayerXP[attacker] += get_pcvar_num(xp_kes)

  199.  

  200.        

  201.         while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])

  202.         {  

  203.                 client_print(attacker, print_chat, "[XP-Mod] Grat! Szinted: %i Rangod: %s !", PlayerLevel[attacker],CLASSES[PlayerClass[attacker]])

  204.      

  205.                 PlayerLevel[attacker] += 1

  206.         }

  207.  

  208.         ShowHud(attacker)

  209.         return PLUGIN_CONTINUE;

  210. }

  211.  

  212.  

  213.  

  214. public ShowHud(id)

  215. {

  216.     set_hudmessage(85, 255, 0, 0.01, 0.90, 0, 6.0, 12.0)

  217.     show_hudmessage(id, "[Szinted] %i [XP]: %i [Rangod] %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])

  218. }

  219.  

  220.  

  221.  

  222. public client_connect(id)

  223. {

  224.     if(get_pcvar_num(xp_mentes) == 1)

  225.     {

  226.         LoadData(id)

  227.     }

  228. }

  229.  

  230. public client_disconnect(id)

  231. {

  232.      if(get_pcvar_num(xp_mentes) == 1)

  233.      {

  234.           SaveData(id)

  235.      }

  236. }

  237.  

  238.  

  239. public SaveData(id)

  240. {

  241.     new name[32]

  242.     get_user_name(id, name, 31)

  243.  

  244.     new vaultkey[64],vaultdata[256]

  245.    

  246.     format(vaultkey,63,"%sXPmod", name)

  247.    

  248.     format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])

  249.  

  250.    

  251.  

  252.     nvault_set(g_vault,vaultkey,vaultdata)

  253.     return PLUGIN_CONTINUE

  254. }

  255.  

  256.  

  257. public LoadData(id)

  258. {

  259.     new name[32]

  260.     get_user_name(id, name, 31)

  261.     new vaultkey[64],vaultdata[256]

  262.    

  263.     format(vaultkey,63,"%sXPmod", name)

  264.     format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])

  265.    

  266.     nvault_get(g_vault,vaultkey,vaultdata,255)

  267.     replace_all(vaultdata, 255, "#", " ")

  268.    

  269.     new playerxp[32], playerlevel[32]

  270.     parse(vaultdata, playerxp, 31, playerlevel, 31)

  271.    

  272.     PlayerXP[id] = str_to_num(playerxp)

  273.     PlayerLevel[id] = str_to_num(playerlevel)

  274.    

  275.     return PLUGIN_CONTINUE

  276. }  

  277.  

Oldal: 1 / 2 Minden időpont UTC+01:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/