Raised This Month: $ Target: $400
 0% 

[FIX] Plugin !!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 05-21-2014 , 12:27   Re: [FIX] Plugin !!
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <cstrike>
#include <fakemeta_util>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "LevelUp System"
#define VERSION "1.0"
#define AUTHOR "-.-"
#define ACCES ADMIN_CVAR
#pragma tabsize 0
new SayText
new g_level[32], g_level_datag_frags_levelg_ScreenFade
new g_level_maxg_level_numg_level_infog_player_nameg_levels[32], g_h_armor
new level_exp[32]
new 
g_level_exp[32], g_exp_datag_Playersg_hud_colornameid[32], h_armor[32]
new 
bool:g_bonus[32], g_trime[32]
new 
sound_level_up[] = { "misc/level_up.wav"}
const 
PEV_SPEC_TARGET pev_iuser2;
// Zombie Classes MUST be registered on plugin_precache

public plugin_precache()
{
        
precache_soundsound_level_up )
}

public 
plugin_init()
{
    
g_frags_level =         register_cvar("zp_level_frags""10")        // ??????? ????????? ????? ??? ????????? ????. ??????
    
g_level_max  =         register_cvar("zp_level_max""1000")            // ???????????? ?????
    
    
g_h_armor =         register_cvar("zp_level_h_armor""1")        // ??????????? ? ?????? ??????? ???? ?? ? ? ?????

    
g_hud_color =         register_cvar("zp_level_hud_type""1")        // 1 - ??????, 2 - ???????? ?????? ??????? 3 - 1 ??? ????????
    
g_level_info =         register_cvar("zp_level_info""1")                // ?????????? ???? ? ??????, ????? ?? ??????? ? ??? info <nick>
    
g_player_name =     register_cvar("zp_player_name""1")        // ?????????? ????, ??? ????????? ???????? ?? ???????
    
g_level_num =         register_cvar("zp_level_number""1")    // ?????? ? ?????? ????? ??????????? ?????  ????????? (???? ???? 1)

    
g_level_data nvault_open("Leveling_Save")
    
g_exp_data nvault_open("Exp_Save")
    
register_clcmd("say","say_info");
    
register_clcmd("say_team","say_info");
    
register_clcmd("zp_levelexp","expa_give"ADMIN_CVAR"use to give Exp")
    
register_clcmd("zp_level_is","level_give"ADMIN_CVAR"use to give Level")
    
SayText get_user_msgid("SayText")
    
g_Players get_maxplayers();
    
register_event("HLTV""Round_Start""a""1=0""2=0")
    
register_event("DeathMsg""Frags_Manager""a""1>0")     
    
register_event("StatusValue","show_status","be","1=2","2!0")
           
register_event("StatusValue","hide_status","be","1=1","2=0")
    
g_ScreenFade get_user_msgid"ScreenFade" )
    
register_plugin(PLUGINVERSIONAUTHOR)
}
public 
Round_Start()
{
    for(new 
id=1;id<=g_Players;id++)
    
set_task(3.0"Level"id)
}

public 
Level(id)
{
    if(
is_user_alive(id) )
    {
        
g_trime[id] = false;
        new 
1;
        while( 
g_level[id] )
        {
            
h_armor[id] = get_pcvar_num(g_h_armor);
            
1
        
}
        
fm_set_user_armoridget_user_armor(id) + h_armor[id])
    }
}

public 
expa_give(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
    {                
        
console_print(id"? ??? ??? ??????? ? ???????")
        return 
PLUGIN_HANDLED
    
}
    new 
target[32]
    new 
count[32]    
    
    
read_argv(1,target,31)
    
read_argv(2,count,31)
    new 
target_idname[32], nameid[32]
    
target_id find_player("bl"target)
    
get_user_name(target_idnamesizeof name 1
    
get_user_name(idnameidsizeof nameid 1)
    if(!
target_id
    {
        
console_print(id"Can't find that player")
        return 
PLUGIN_HANDLED
    
}
    if(
read_argc() != 3)
    return 
PLUGIN_HANDLED    

    
if(str_to_num(count) < (g_level_exp[target_id] - level_exp[target_id]) )
    {
        if(
str_to_num(count) == 0)
        
console_print(id"Exp Player %s in %i / %i"namelevel_exp[target_id], g_level_exp[target_id])
        else
        {
            
console_print(id"Player %s gives for %i exp, Her Maximum %i"namestr_to_num(count), g_level_exp[target_id])
            
level_exp[target_id] = level_exp[target_id] + str_to_num(count);
        }
        
    }
    else
    {
        
console_print(id"Maximum Exp in player %i"g_level_exp[target_id])
    }
    return 
PLUGIN_HANDLED
}

public 
level_give(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
    {                
        
console_print(id"? ??? ??? ??????? ? ???????")
        return 
PLUGIN_HANDLED
    
}
    new 
target[32]
    new 
count[32]    
    
    
read_argv(1,target,31)
    
read_argv(2,count,31)
    new 
target_idname[32], level_id
    level_id 
str_to_num(count);
    
target_id find_player("bl"target)
    
get_user_name(target_idnamesizeof name 1
    if(!
target_id
    {
        
console_print(id"Can't find that player")
        return 
PLUGIN_HANDLED
    
}
    if(
read_argc() != 3)
    return 
PLUGIN_HANDLED    

    
if( ((g_level[target_id] + level_id) <=get_pcvar_num(g_level_max)) && (level_id != 0) && ((g_level[target_id] + level_id) > ) )
    {
        if(
level_id 0)
        {
            
g_level[target_id] = g_level[target_id] + level_id;
            
level_exp[target_id] = 0;
            
message_begin(MSG_ONE_UNRELIABLEg_ScreenFade_target_id)
                   
write_short(1<<12// duration
                
write_short(1// hold time
            
write_short(0x0000// fade type
            
write_byte(1// red
            
write_byte(200// green
            
write_byte(0// blue
            
write_byte(205// alpha
            
message_end()
            
emit_sound(target_idCHAN_STREAMsound_level_up1.0ATTN_NORM0PITCH_HIGH )
        }
        else
        {
            
g_level[target_id] = g_level[target_id] + level_id;
            
level_exp[target_id] = 0;
            
message_begin(MSG_ONE_UNRELIABLEg_ScreenFade_target_id)
                   
write_short(1<<12// duration
                
write_short(1// hold time
            
write_short(0x0000// fade type
            
write_byte(200// red
            
write_byte(40// green
            
write_byte(0// blue
            
write_byte(205// alpha
            
message_end()
        }
            
console_print(id"Player %s gives add %i level"namelevel_id)
    }
    else
        
console_print(id"Operation Invalid")
    return 
PLUGIN_HANDLED
}

public 
client_putinserver(id)
{
    
Level_Load(id)
    new 
name[32]
    
g_trime[id] = false;
    
g_bonus[id] = true;
    
nameid[id] = get_user_name(idnamesizeof name 1)
    if(
is_user_alive(id))
    {
        
g_trime[id] = false;
        new 
1;
        while( 
!= g_level[id] )
        {
            
h_armor[id] = set_user_armor(id,get_pcvar_num(g_h_armor))
            
1;
        }
        
fm_set_user_armoridget_user_armor(id) + h_armor[id] )
    }
    if( 
g_level[id] == 0g_level[id] = 1;
    if( 
level_exp[id] == g_level[id] ) level_exp[id] = 0;
    if(
g_level[id] < get_pcvar_num(g_level_num))
    
g_levels[id] = get_pcvar_num(g_level_num);
    else
    {
        if(
g_level[id] != g_levels[id])
        {
            new 
1;
            while( 
g_level[id] > ( get_pcvar_num(g_level_num)) )
            {
                
1;
                
g_levels[id] = get_pcvar_num(g_level_num);
            }
        }
    }
    new 
1;
    while( 
g_level[id] != )
    {
    
1;
    
g_level_exp[id] = get_pcvar_num(g_frags_level);
    }
}

public 
client_disconnect(id)
{
    new 
name[32], player_nick[32]
    
player_nick[id] = get_user_name(idnamesizeof name 1)
    if(
player_nick[id] == nameid[id])
    
Level_Save(id)
    
    
g_trime[id] = false;
}

public 
hide_status(id)
{
        
set_hudmessage(0,0,0,0.0,0.0,00.00.010.00.04)
        
show_hudmessage(id,"")
}

public 
show_status(id)
{
       new 
name[32],pid read_data(2)
       
get_user_name(pid,name,31)
       if (!(
get_pcvar_num(g_player_name) == 1) )
    {
               
set_hudmessage(0,255,0,-1.0,0.9,01.01.10.00.0, -1)
               
show_hudmessage(id,"[ Level : %d | Exp : %d/%d ]",g_level[id], level_exp[id], g_level_exp[id])
    }
    else
   {
       new 
Spec;
       new 
PlayerName[32];
       
get_user_name(SpecPlayerName31);
       
Spec pev(idPEV_SPEC_TARGET);
              
set_hudmessage(255,0,255, -1.00.8506.01.10.00.0, -1);
              
show_hudmessageid,"Spectating: %s ^n[ Level : %d | Exp : %d/%d ]",PlayerNameg_level[Spec], level_exp[Spec], g_level_exp[Spec])
   }
}  

public 
say_info(id)
{
    new 
text[70], arg1[32], target[32], count[32]
    
read_args(textsizeof(text)-1);
    
remove_quotes(text);
    
arg1[0] = '^0';
    
target[0] = '^0';
    
count[0] = '^0';
    
parse(textarg1sizeof(arg1)-1targetsizeof(target)-1countsizeof(count)-1);
    if ( 
equali(arg1"info"4) )
    {
        
info_player(idtarget);
    }
    if ( 
equali(arg1"bonusme"7) && (get_pcvar_num(g_level_info) == 1))
    {
        
expa_player(id);
    }
    return 
PLUGIN_CONTINUE;
}

public 
zp_extra_item_selected(iditemid)
{
    
Level_Save(id)
}

public 
zp_user_infected_pre(idinfector)
{
    if( 
is_user_alive(infector) && (level_exp[infector] < (g_level_exp[infector] - 1)))
    {
        
level_exp[infector] = level_exp[infector] + 1;
        
Level_Save(infector);
    }
}

public 
expa_player(id)
{
    
ChatColor(id"^1Your Exp: ^4%i/%i"level_exp[id], g_level_exp[id])
    return 
PLUGIN_HANDLED
}

public 
info_player(idtarget[])
{
    new 
target_2;
    
target_2 find_player("bl"target)
    static 
name[32], nameid[32];
    
get_user_name(target_2namesizeof name 1)
    
get_user_name(idnameidsizeof nameid 1)
    if(!
target_2)
    {
        
ChatColor(id"^1Such ^4nickname^1 isn't found, or incorrect inquiry.")
        return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_HANDLED
}

public 
level_status(id)
{
    if( 
is_user_alive(id))
    {
        switch( 
get_pcvar_num(g_hud_color) ) 
            { 
                    case 
1
                    { 
            
set_hudmessage(02550, -1.00.906.01.10.00.0, -1)
            
show_hudmessage(id,"[ Level : %d | Exp : %d/%d ]",g_level[id], level_exp[id], g_level_exp[id])
                    } 
                    case 
2
            {
            
set_hudmessage(02550, -1.00.906.01.10.00.0, -1)
            
show_hudmessage(id,"[ Level : %d | Exp : %d/%d ]",g_level[id], level_exp[id], g_level_exp[id])
            }
                    case 
3
            {
            
set_hudmessage(02550, -1.00.906.01.10.00.0, -1)
            
show_hudmessage(id,"[ Level : %d | Exp : %d/%d ]",g_level[id], level_exp[id], g_level_exp[id])
            }
        }
    }
}

public 
Level_Save(id)
{
    new 
key[64], data[256], data_exp[256], key_exp[64]
    new 
name[33];
    
get_user_name(id,name,32)

    
format(key63"%s-/"name)
    
format(data255"%i#"g_level[id])

    
format(key_exp63"%s-/"name)
    
format(data_exp255"%i#"level_exp[id])

    
nvault_set(g_level_datakeydata)
    
nvault_set(g_exp_datakey_expdata_exp)
    return 
PLUGIN_CONTINUE;
}

public 
Level_Load(id)
{
    new 
key[64], data[256], data_exp[256], key_exp[64]
    new 
name[33];
    
get_user_name(id,name,32)

    
format(key63"%s-/"name)
    
format(data255"%i#"g_level[id])

    
format(key_exp63"%s-/"name)
    
format(data_exp255"%i#"level_exp[id])

    
nvault_get(g_level_datakeydata255)
    
nvault_get(g_exp_datakey_expdata_exp255)
    
replace_all(data255"#"" ")
    
replace_all(data_exp255"#"" ")

    new 
givelevel[32], give_exp[32]
    
parse(datagivelevel31)
    
parse(data_expgive_exp31)
    
g_level[id] = str_to_num(givelevel)
    
level_exp[id] = str_to_num(give_exp)

    
set_task(1.0"level_status"id__"b")
    return 
PLUGIN_CONTINUE;
}

public 
Frags_Manager()
{
    new 
aname[32], attackerattacker read_data(1)
    new 
y1;
    
get_user_name(attackeranamesizeof aname 1)
    if( ( 
level_exp[attacker] >= (g_level_exp[attacker] - 1) ) && (g_level[attacker] <= get_pcvar_num(g_level_max)) && is_user_alive(attacker) )
    {
        
g_level[attacker] = g_level[attacker] + 1;
        
level_exp[attacker] = 0;
        while( 
g_level[attacker] != )
        {
            
1;
            
g_level_exp[attacker] = get_pcvar_num(g_frags_level);
        }
        
message_begin(MSG_ONE_UNRELIABLEg_ScreenFade_attacker)
          
write_short(1<<12// duration
          
write_short(1// hold time
        
write_short(0x0000// fade type
        
write_byte(1// red
        
write_byte(200// green
        
write_byte(0// blue
        
write_byte(205// alpha
        
message_end()
        
emit_sound(attackerCHAN_STREAMsound_level_up1.0ATTN_NORM0PITCH_HIGH )
        
set_hudmessage(020000.650.500.03.02.01.0, -1)
        
show_hudmessage(0"%s has cut down %i level"anameg_level[attacker])
        
Level_Save(attacker);
    }
    else
    {

        if(
g_level[attacker] == get_pcvar_num(g_level_max))
        
ChatColor(attacker"you have reached a maximum level:! g%i"g_level[attacker] )
        
level_exp[attacker] = level_exp[attacker] + 1;
        
Level_Save(attacker);
    }
}

public 
zp_round_ended(winteam)
{
    for(new 
id=1;id<=g_Players;id++)
    
g_trime[id] = true;
}

stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)

    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!t""^3"// Team Color
    
replace_all(msg190"!t2""^0"// Team2 Color

    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLESayText_players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

Freezo Begin is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode