Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #include <dhudmessage>
- #include <nvault>
- #include <zombieplague>
- #define HUD 672
- new max_level = 200, g_sync1, g_podaci, _pcvar_killxp, xp_igraca[33], CinX[33], level_igraca[33] = 1;
- new const Cinovi[][]=
- {
- "Pocetnik",
- "Vojnik",
- "Regrut",
- "Admiral",
- "Pro Strelac",
- "General",
- "Marsal",
- "Zombie Pro",
- "Narkoman",
- "Zombie Master",
- "Swat",
- "Zombie Kralj"
- }
- public plugin_init() {
- register_plugin("[ZP] Level System", "1.0b", "MegastorM")
- g_podaci = nvault_open("zm_level_mod");
- register_event("DeathMsg", "player_death", "ade");
- _pcvar_killxp = register_cvar("zp_lvl_killxp","1")
- register_concmd("zp_set_lvl", "cmd_lvl", ADMIN_RCON, "<nick> <level>");
- g_sync1 = CreateHudSyncObj()
- }
- public cmd_lvl(id, level, cid)
- {
- if(!cmd_access(id,level,cid,2))
- return PLUGIN_HANDLED;
- new arg1[33];
- new arg2[6];
- read_argv(1, arg1, 32);
- read_argv(2, arg2, 5);
- new player = cmd_target(id, arg1);
- if(!is_user_connected(player))
- return PLUGIN_HANDLED;
- new value = str_to_num(arg2)-1;
- xp_igraca[player] = xp_za_level(value);
- level_igraca[player] = 0;
- proverilvl(player);
- return PLUGIN_HANDLED;
- }
- public pokazi_podatke(id)
- {
- id -= HUD
- if(!is_user_alive(id))
- return PLUGIN_HANDLED
- set_task(0.1, "pokazi_podatke", id+HUD);
- new ime[32]
- get_user_name(id, ime, charsmax(ime))
- set_dhudmessage(200, 0, 0, 0.02, 0.75, 0, 0.0, 0.3, 0.0, 0.0);
- show_dhudmessage(id, "[Nick: %s]^n[Level: %i]^n[Exp: %i / %i]^n[Cin: %s]",ime,level_igraca[id], xp_igraca[id], xp_za_level(level_igraca[id]), Cinovi[CinX[id]])
- return PLUGIN_CONTINUE;
- }
- public player_death()
- {
- new attacker = read_data(1)
- if(!is_user_connected(attacker))
- return PLUGIN_HANDLED
- new xp_za_ubistvo = get_pcvar_num(_pcvar_killxp)
- if(level_igraca[attacker] < max_level || xp_igraca[attacker] >= 1999)
- {
- xp_igraca[attacker] += xp_za_ubistvo
- proverilvl(attacker)
- }
- else
- {
- level_igraca[attacker] = max_level
- proverilvl(attacker)
- }
- return PLUGIN_CONTINUE
- }
- public proverilvl(id)
- {
- if(level_igraca[id] >= max_level)
- return PLUGIN_HANDLED
- if(level_igraca[id] < max_level)
- {
- while(xp_igraca[id] >= xp_za_level(level_igraca[id]))
- {
- level_igraca[id]++
- set_hudmessage(200, 0, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.2);
- ShowSyncHudMsg(id, g_sync1, "%i level!", level_igraca[id]);
- }
- }
- else
- {
- level_igraca[id] = max_level
- }
- switch(level_igraca[id])
- {
- case 1:
- {
- CinX[id] = 1
- }
- case 2..3:
- {
- CinX[id] = 2
- }
- case 4..7:
- {
- CinX[id] = 3
- }
- case 8..15:
- {
- CinX[id] = 4
- }
- case 16..23:
- {
- CinX[id] = 5
- }
- case 24..31:
- {
- CinX[id] = 6
- }
- case 32..63:
- {
- CinX[id] = 7
- }
- case 64..74:
- {
- CinX[id] = 8
- }
- case 75..127:
- {
- CinX[id] = 9
- }
- case 128..155:
- {
- CinX[id] = 10
- }
- case 156..191:
- {
- CinX[id] = 11
- }
- case 192..200:
- {
- CinX[id] = 12
- }
- }
- return PLUGIN_CONTINUE
- }
- public zp_user_infected_post()
- {
- new attacker = read_data(1)
- if(!is_user_connected(attacker))
- return PLUGIN_HANDLED
- xp_igraca[attacker]++
- proverilvl(attacker)
- return PLUGIN_CONTINUE
- }
- public xp_za_level(lvl)
- return lvl*10;
- public client_putinserver(id)
- {
- level_igraca[id] = 1
- Ucitaj(id)
- set_task(3.0, "pokazi_podatke", id+HUD);
- }
- public client_disconnect(id)
- {
- Sacuvaj(id)
- }
- public Sacuvaj(id)
- {
- new vltkey[128]
- new podaci[256]
- new steam_id_igraca[64];
- format(podaci, charsmax(podaci),"#%i#%i#%i", xp_igraca[id], level_igraca[id], CinX[id]);
- get_user_authid(id, steam_id_igraca, charsmax(steam_id_igraca))
- format(vltkey, charsmax(vltkey),"%s-zm_lvl_mod", steam_id_igraca);
- nvault_set(g_podaci,vltkey,podaci);
- return PLUGIN_CONTINUE;
- }
- public Ucitaj(id)
- {
- new vltkey[128]
- new podaci[256]
- new steam_id_igraca[64];
- get_user_authid(id, steam_id_igraca, charsmax(steam_id_igraca))
- format(vltkey, charsmax(vltkey),"%s-zm_lvl_mod", steam_id_igraca);
- nvault_get(g_podaci,vltkey,podaci,255);
- replace_all(podaci, 255, "#", " ");
- new plrinfo[3][32];
- parse(podaci, plrinfo[0], 31, plrinfo[1], 31, plrinfo[2], 31);
- xp_igraca[id] = str_to_num(plrinfo[0]);
- level_igraca[id] = str_to_num(plrinfo[1])>0?str_to_num(plrinfo[1]):1;
- CinX[id] = str_to_num(plrinfo[2]);
- return PLUGIN_CONTINUE;
- }
- public plugin_end()
- nvault_close(g_podaci)
Advertisement
Add Comment
Please, Sign In to add comment