Raised This Month: $12 Target: $400
 3% 

Solved deathrun exp,grade,point nvault problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Suntox
Member
Join Date: Nov 2016
Old 11-15-2017 , 20:43   deathrun exp,grade,point nvault problem
Reply With Quote #1

hello
can someone fix nvault on this plugin ?
when i restart map or server. the exp,grade and points return to 0, only level who loads

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


native g_jump(id)
#pragma tabsize 0

#define PLUGIN "dr"
#define VERSION "3.2"
#define AUTHOR "ss"

#define is_valid_player(%1) (1 <= %1 <= 32)

new g_level[32], g_level_datag_frags_levelg_ScreenFade
new g_level_maxg_level_numg_levels[32]
new 
level_exp[32], g_aim_infobuffer[32]
new 
g_level_exp[32], g_Playersnameid[32], g_points[32]
new 
g_trime[32], g_MsgSyncgGrads[32]
new 
sound_level_up[] = { "Level_Up.wav"}
const 
PEV_SPEC_TARGET pev_iuser2
new g_iTarget [33];
new 
g_Lifes[33];

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""150")
    
g_aim_info register_cvar("xp_aim_info""1")
    
g_level_num register_cvar("zp_level_number""1")
    
    
register_clcmd("say /shop""Shop_Items")
    
register_clcmd("say shop""Shop_Items")
    
register_clcmd("say donate""Donate_Menu" );
    
register_clcmd("say /donate""Donate_Menu" );
    
register_clcmd("say /showpoint""ShowPoints" );
    
register_clcmd("say /mypoints""cmd_showgolds" );
    
    
register_concmd("ms_point_""cmd_set"ADMIN_IMMUNITY"<name> <points> - set points to a player" );
    
register_concmd("rs_point_""cmd_reset"ADMIN_IMMUNITY"<name> <points> - reset player points" );
    
    
register_concmd("gamble""CmdGamble"_"usage: gamble <cash>")
    
    
g_level_data nvault_open("Leveling_Save")
    
register_event("HLTV""Round_Start""a""1=0""2=0")
    
register_event("DeathMsg""Frags_Manager""a""1>0"
    
register_event("DeathMsg""eDeath""a")
    
g_ScreenFade get_user_msgid"ScreenFade" )
    
register_event("StatusValue","show_status","b e","1=2","2!0")
    
register_event("StatusValue","hide_status","b e","1=1","2=0")
    
g_Players =get_maxplayers()
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_MsgSync CreateHudSyncObj()
}

public 
plugin_natives() { 
    
    
register_native("get_user_points""native_get_user_points"1); 
    
register_native("set_user_points""native_set_user_points"1);     
}   

public 
native_get_user_points(id

    return 
g_points[id]; 


public 
native_set_user_points(idamount

    
g_points[id] = amount

new const 
Grads[][] =
{
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Enemy Killer"
}

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] )
        {
            
1
        
}
    }
}

public 
client_putinserver(id)
{
    if(!
is_user_bot(id) && is_valid_player(id))
        
Level_Load(id)
    
g_level_exp[id] = get_pcvar_num(g_frags_level)
    new 
name[32]
    
g_trime[id] = false;
    
nameid[id] = get_user_name(idnamesizeof name 1)
    if(
is_user_alive(id))
    {
        
g_trime[id] = false;
        new 
1;
        while( 
!= g_level[id] )
        {
            
1;
        }
    }
    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 
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)
    switch(
get_user_team(pid)) 
    { 
        case 
1copy(buffer31"Terrorist"
        case 
2copy(buffer31"Counter-Terrorist"
        } 
    if(
get_pcvar_num(g_aim_info) == 1)
    {
        
set_hudmessage(random_num(200,150),random_num (100,50),random_num(50,25),-1.0,0.60,10.014.00.010.014)
        
show_hudmessage(id"%s^n[ Health : %d | Team : %s ]^n[ Grade : %s | Level : %i | Exp : %i/%i | Dr.Points : %d ]",nameget_user_health(pid), bufferGrads[gGrads[pid]], g_level[pid], level_exp[pid], g_level_exp[pid], g_points[pid])
    }
}

public 
eDeath() 
{
    new 
attacker read_data(1)
    new 
victim read_data(2)
    new 
headshot read_data(3)
    
    if(
get_user_team(attacker) != get_user_team(victim)) 
    {
        
g_points[attacker] += 1
    
}
    
    else
    {
        if(
attacker == victim)
        { 
            
g_points[attacker] += 0
        
}
        
        else
        {
            if(!
headshot)
                
g_points[attacker] += 2
            
else
                
g_points[attacker] += 2
            
        
}
    }
}

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)
    }
    
Level_Save(id)    
    
g_trime[id] = false;
}

public 
level_status(id)
{
    new 
Spec
    Spec 
pev(idPEV_SPEC_TARGET)
    new 
PlayerName[32]
    
get_user_name(SpecPlayerName31)
    switch(
get_user_team(id)) 
    { 
        case 
1copy(buffer31"Terrorist"
        case 
2copy(buffer31"Counter-Terrorist"
        } 
    if(
is_user_alive(id))
    {
        
set_hudmessage(1018010, -1.00.8706.01.1)
        
ShowSyncHudMsg(idg_MsgSync"[ Health : %d | Team : %s ]^n[ Grade : %s | Level : %i | Exp : %i/%i | Dr.Points : %d ]",get_user_health(id), bufferGrads[gGrads[id]], g_level[id], level_exp[id], g_level_exp[id], g_points[id])
    }
    else
        switch(
get_user_team(Spec)) 
    { 
        case 
1copy(buffer31"Terrorist"
            case 
2copy(buffer31"Counter-Terrorist"
        } 
    if(
is_user_alive(Spec))
    {
        
set_hudmessage(20030200, -1.00.7906.01.1)
        
ShowSyncHudMsg(idg_MsgSync"Spectating: %s ^n[ Health : %d | Team : %s ]^n[ Grade : %s | Level : %i | Exp : %i/%i | Dr.Points : %d ]",PlayerNameget_user_health(Spec), bufferGrads[gGrads[id]], g_level[Spec], level_exp[Spec], g_level_exp[Spec], g_points[Spec])
    }
}

public 
Level_Save(id)
{
    new 
vaultkey[64], vaultdata[256]
    new 
AuthID[35
    
get_user_name(id,AuthID,34
    
    
format(vaultkey63"%s-/"AuthID)
    
format(vaultdata255"%i# %i# %d# %s#"g_level[id], level_exp[id], g_points[id], gGrads[id])
    
    
nvault_set(g_level_datavaultkeyvaultdata)
    return 
PLUGIN_CONTINUE;
}

public 
Level_Load(id)
{
    new 
vaultkey[64], vaultdata[256]
    new 
AuthID[35
    
get_user_name(id,AuthID,34
    
    
format(vaultkey63"%s-/"AuthID)
    
format(vaultdata255"%i# %i# %d# %s#"g_level[id], level_exp[id], g_points[id], gGrads[id])
    
    
nvault_get(g_level_datavaultkeyvaultdata255)
    
    
replace_all(vaultdata255"#"" "
    
    new 
givelevel[32]
    
parse(vaultdatagivelevel31)
    
    
g_level[id] = str_to_num(givelevel)
    
    
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))
            
ColorChat(attacker,GREEN,"[MS] ^1You have reached the maximum Level: ^4%i"g_level[attacker])
        
level_exp[attacker] = level_exp[attacker] + 1;
        
Level_Save(attacker);
    }
}

public 
Shop_Items(iPlayer)
{
    new 
szText[555 char]
    
    
formatex(szTextcharsmax(szText), "\r[MS] \yDeathRun Shop \d[\rYour Points : %d\d]^n^n"g_points[iPlayer])
    new 
AdminMenu menu_create(szText"Dr_Shop")
    
    
formatex(szTextcharsmax(szText), "%sRespawn \r[Only Dead] \y[5 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"1"0)
    
    
formatex(szTextcharsmax(szText), "%sInvisibility \r[10 Seconds] \y[15 Dr-Points]"g_points[iPlayer] >= 15 "\w":"\d")
    
menu_additem(AdminMenuszText"2"0)    
    
    
formatex(szTextcharsmax(szText), "%sHealth \r[100 Health] \y[5 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"3"0)
    
    
formatex(szTextcharsmax(szText), "%sFlash Bang \r[] \y[4 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"4"0)
    
    
formatex(szTextcharsmax(szText), "%sSmoke Grenade \r[] \y[4 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"5"0)
    
    
formatex(szTextcharsmax(szText), "%sHe Grenade \r[] \y[4 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"6"0)

    
formatex(szTextcharsmax(szText), "%sMultiJump \r[+1 Jump] \y[6 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"7"0)
    
    
formatex(szTextcharsmax(szText), "%sDesert Eagle \r[7 Bullets] \y[70 Dr-Points]"g_points[iPlayer] >= 70 "\w":"\d")
    
menu_additem(AdminMenuszText"8"0)
    
    
formatex(szTextcharsmax(szText), "%sImmortality \r[10 Seconds] \y[40 Dr-Points]"g_points[iPlayer] >= 40 "\w":"\d")
    
menu_additem(AdminMenuszText"9"0)
    
    
formatex(szTextcharsmax(szText), "%sNoclip \r[2 Seconds] \y[100 Dr-Points]"g_points[iPlayer] >= 100 "\w":"\d")
    
menu_additem(AdminMenuszText"10"0)
    
    
formatex(szTextcharsmax(szText), "%sGlow \r[Random Glow] \y[8 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"11"0)
    
    
menu_setprop(AdminMenuMPROP_EXITMEXIT_ALL)
    
menu_display(iPlayerAdminMenu0)
    
    return 
PLUGIN_HANDLED
}

public 
Set_p(id
{
    
g_points[id] += 6000
    g_Lifes
[id] += 600 
}

public 
Dr_Shop(idmenuitem
{  
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdatacharsmax(data), iNamecharsmax(iName), callback )
    new 
key str_to_num(data)
    
    switch(
key)
    {           
        case 
1:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Respawn")
                return 
PLUGIN_HANDLED     
            
}
            if( 
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Dead people can purchase ^3Respawn ^1ability" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"^4[MS] ^1You bought ^3Respawn ^1ability")  
            
ExecuteHamB(Ham_CS_RoundRespawnid)
            
g_points[id] -= 2
        
}
        
        case 
2:
        {
            if( 
g_points[id] < 15 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Invisibility")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Invisibility" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= 15 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Invisibility ^1For^4 10 Seconds")  
            
g_points[id] -= 15
            set_user_footsteps
(id1)
            
set_user_rendering(idkRenderFxNone000kRenderTransAlpha 0)
            
set_user_maxspeed(id,get_user_maxspeed(id) + 500)
            
            
set_task(10.0"Set_Invi",id);
        }
        
        case 
3:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy^3 100 Health")
                return 
PLUGIN_HANDLED     
            
}    
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase^3 100 Health" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 100 ^1Health")  
            
g_points[id] -= 5
            set_user_health
(idget_user_health(id) + 100)
        }        
        
        case 
4:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Flash Bang")
                return 
PLUGIN_HANDLED     
            

            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Flash Bang" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 Flashbang")  
            
g_points[id] -= 4
            give_item 
(id,"weapon_flashbang")
            
cs_set_user_bpammo(idCSW_FLASHBANGcs_get_user_bpammo(idCSW_FLASHBANG) + 1)
        }        
        case 
5:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Smoke Grenade")
                return 
PLUGIN_HANDLED
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Smoke Grenade" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 Smoke grenade")   
            
g_points[id] -= 4
            give_item 
(id,"weapon_smokegrenade")
            
cs_set_user_bpammo(idCSW_SMOKEGRENADEcs_get_user_bpammo(idCSW_SMOKEGRENADE) + 1)
        }
        case 
6:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3He Grenade")
                return 
PLUGIN_HANDLED
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3He Grenade" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 He Grenade")   
            
g_points[id] -= 4
            give_item 
(id,"weapon_hegrenade")
            
cs_set_user_bpammo(idCSW_HEGRENADEcs_get_user_bpammo(idCSW_HEGRENADE) + 1)
        }
        case 
7:
        {
            
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Multijump")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3 Multijump x1" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought ^3Multijump x1")  
            
g_points[id] -= 6
            g_jump
(id)
        }        
        case 
8:
        {
            if( 
g_points[id] < 70 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Deagle")
                return 
PLUGIN_HANDLED
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Deagle" )  
                return 
PLUGIN_HANDLED
            

            else
                if( 
g_points[id] >= 70 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Desert-Eagle")
            
g_points[id] -=8
            give_item
id"weapon_deagle" )
        }        
        case 
9:
        {
            
            if( 
g_points[id] < 40 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Immortality")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Immortality" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= 40 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Immortality ^1For^4 10 Seconds")  
            
g_points[id] -= 40
            set_user_godmode
(id1)
            
set_task(10.0"immort"id)
        }   
        case 
10:
        {
            
            if( 
g_points[id] < 100 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Noclip")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Noclip" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= 100 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Noclip ^1For^4 2 Seconds")  
            
g_points[id] -= 100
            set_user_noclip
(id1)
            
set_task(2.0"noc"id)
        }  
        case 
11:
        {
            
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Glow")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Glow" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Random Glow")  
            
g_points[id] -= 8
            set_user_rendering
(idkRenderFxGlowShell,  random_num(0,255),  random_num(0,255),  random_num(0,255), kRenderNormal16 )
        }  
        
    }
    return 
PLUGIN_HANDLED
}

public 
Set_Invi(id)
{
    
ColorChat(id,GREEN,"^4[MS] ^3Invisibility ^1has been removed!")     
    
set_user_footsteps(id0)    
    
set_user_rendering(id0
    return 
PLUGIN_HANDLED


public 
ShowPoints(id)
{
    static 
opcion[64]
    
    
formatex(opcioncharsmax(opcion),"\r[MS] \yShow Players Points :")
    new 
iMenu menu_create(opcion"Handlegolds")
    
    new 
players[32], pnumtempid
    
new szName[32], szTempid[10]
    
    
get_players(playerspnum"ch")
    
    for( new 
ii<pnumi++ )
    {
        
        
tempid players[i]
        
        
get_user_name(tempidszName31)
        
num_to_str(tempidszTempid9)
        
        
formatex(opcion,127,"\w%s \d[ \r%i Points\d ]",szNameg_points[tempid]);
        
menu_additem(iMenuopcionszTempid0)
    }
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
Handlegolds(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], name[64]
    new 
accesscallback
    
    menu_item_getinfo 
(menuitemaccessdata5name63callback)
    new 
tempid str_to_num (data)
    
    new 
szName[33], szPlayerName[33]
    
    
get_user_name(idszName32)
    
get_user_name(tempidszPlayerName32)
    
    
ColorChat(idRED"^4[MS] ^1Player ^3%s ^1has ^3%i ^4Drpoints ^1!",szPlayerNameg_points[tempid])
    
    
ShowPoints(id);
    
    return 
PLUGIN_CONTINUE
}


public 
Donate_Menu(id)
{
    new 
iMenu menu_create("\r[MS] \yDonate Players Menu""handleDonate");
    
    new 
iPlayers[32], szName[32], szKey[3], iNumiPlayer;
    
get_players(iPlayersiNum,"ch");
    
    for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
get_user_name(iPlayerszNamecharsmax(szName));
        
        
menu_additem(iMenuszNameszKey);
    }
    
    
menu_setprop(iMenuMPROP_EXITNAME"Back");
    
menu_display(idiMenu0);
    return 
0;
}


public 
handleDonate(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData[6], iAccessiCallback;
    
menu_item_getinfo(menuitemiAccessszDatacharsmax(szData), __iCallback);
    
    
g_iTarget[id] = str_to_num(szData);
    new 
szName[32];
    
get_user_name(g_iTarget[id], szNamecharsmax(szName));
    
    
client_cmd(id"messagemode Donate");
    return 
PLUGIN_HANDLED;
}


public 
CmdDonate(id)
{
    new 
szArg[5];
    
read_argv(1szArgcharsmax(szArg));
    
    
    new 
iValue str_to_num(szArg);
    
    if( 
iValue g_points[id] )
    {
        
ColorChat(id,GREEN"^4[MS] ^1You only have ^3%i ^4Drpoints ^1!",g_points[id]);
        return 
PLUGIN_HANDLED;
    }
    
    new 
iTarget g_iTarget[id];
    
    if( !
iTarget )
    {
        return 
PLUGIN_HANDLED;
    }
    
    if( 
iTarget == id )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
g_points[id] -= iValue;
    
    
g_points[iTarget] += iValue;
    
    new 
szName[2][32];
    
get_user_name(iTargetszName[0], charsmax(szName[]));
    
get_user_name(idszName[1], charsmax(szName[]));
    
    
ColorChat(id,GREEN"^4[MS] ^1You donated ^3%i^4Drpoints ^1to ^3%s ^1!"iValueszName[0]);
    
ColorChat(iTarget,GREEN"^4[MS] ^3%s^1 sent you ^3%i ^4Drpoints"szName[1], iValue);
    
    
    return 
PLUGIN_HANDLED;
}


public 
cmd_showgolds(id)
{    
    
set_hudmessage(02552550.00.8706.012.0)
    
show_hudmessage(id"You Have %d Points"g_points [id] )
    
    
ColorChatidGREEN"^4[MS] ^1You have ^3%d ^4Drpoints ^1!"g_pointsid ] );    
}


public 
cmd_set(id,level,cid)
{
    if ( !(
get_user_flags(id) & ADMIN_IMMUNITY) )
        return 
PLUGIN_HANDLED
    
    
else
    {
        new 
target[32], pid
        read_argv
(1,target,31)
        
pid cmd_target(id,target,2)
        
        new 
amountstr[10], amount
        read_argv
(2,amountstr,9)
        
amount str_to_num(amountstr)
        
        new 
name[32], tname[32]
        
get_user_name(id,name,31)
        
get_user_name(pid,tname,31)
        
        
g_points[pid] += amount
        ColorChat
(idGREEN"^4[MS] ^1You sent ^3%d ^4Drpoints ^1to ^3%s ^1!"amounttname)
        
ColorChat(pidGREEN"^4[MS] ^1Admin ^3%s ^1sent ^3%d ^4Drpoints ^1to you, Now you have ^3%d ^4Drpoints ^1!"nameamount,g_points[pid])
    }    
    return 
PLUGIN_HANDLED
}


public 
cmd_reset(id,level,cid)
{
    if ( !(
get_user_flags(id) & ADMIN_IMMUNITY) )
        return 
PLUGIN_HANDLED
        
    
else
    {
        new 
target[32], pid
        read_argv
(1,target,31)
        
pid cmd_target(id,target,2)
        
        new 
amountstr[10], amount
        read_argv
(2,amountstr,9)
        
amount str_to_num(amountstr)
        
        new 
name[32], tname[32]
        
get_user_name(id,name,31)
        
get_user_name(pid,tname,31)
        
        if((
g_points[pid] -= amount) < 0)
            
        
amount g_points[pid]
        
        
g_points[pid] -= amount
        ColorChat
(idGREEN"^4[MS] ^1You removed ^3%d ^4Drpoints ^1from ^3%s ^1!"amounttname)
        
ColorChat(pidGREEN"^4[MS] ^1Admin ^3%s ^1removed from you ^3%d ^4Drpoints ^4! ^1Now you have ^3%d ^4Drpoints ^1!"nameamount,g_points[pid])
    }
    return 
PLUGIN_HANDLED
    
}

public 
immort(id) {
    if(
is_user_alive(id))
    {
        
set_user_godmode(id0)
        
ColorChat(idGREEN"^4[MS] ^3Immortality ^1has been removed!")
    }
}

public 
noc(id) {
    if(
is_user_alive(id))
    {
        
set_user_noclip(id0)
        
ColorChat(idGREEN"^4[MS] ^3Noclip ^1has been removed!")
    }
}
public 
glow(id) {
    if (!
is_user_alive(id))
    {
        
set_user_renderingidkRenderFxNone000kRenderNormal)
    }
}

public 
CmdGamble(id) {
    new 
cash native_get_user_points(id)
    new 
szName[32]
    
    if(
cash 10) {
        
console_print(id"[MS][Gamble] You need at least 10 DrPoints to gamble.")
        
ColorChat(id,GREEN,"^4[MS][Gamble]^1 You need at least^4 10 ^3DrPoints^1 to gamble.")
        return 
PLUGIN_HANDLED
    
}
    
    else {
        new 
argv[35], gamblecash
        read_argv
(1argvcharsmax(argv))
        
gamblecash str_to_num(argv)
        
        if(
gamblecash 10) {
            
console_print(id"[MS][Gamble] You need to gamble at least 10 Drpoints")
            
ColorChat(id,GREEN,"^4[MS][Gamble]^1 You need to gamble at least^4 10 ^3Drpoints")
            return 
PLUGIN_HANDLED
        
}
        
        if(
cash gamblecash) {
            
console_print(id"[MS][Gamble] You only have %i Drpoints"cash)
        
ColorChat(id,GREEN"^4[MS][Gamble]^1 You only have ^4%i^3Drpoints"cash)
            return 
PLUGIN_HANDLED
        
}
        
        new 
dice random_num(1100)
        
        if(
dice 52) {
            
native_set_user_points(idcash += gamblecash)
            
console_print(id"[MS][Gamble] Congratulations, you won a total of %i Drpoints"gamblecash)
            
console_print(id"[MS][Gamble] You now have a total of %i"cash)
        
ColorChat(0,GREEN,"^4[MS][Gamble]^1 Player:^3%s^1 Gambled ^4%i ^1and won ^4%i ^1of ^3Drpoints ^1!!!",szNamegamblecashcash)
        }
        
        else if(
dice 48) {
            
native_set_user_points(idcash -= gamblecash)
            
console_print(id"[MS][Gamble] Oh no... You lost %i cash"gamblecash)
            
console_print(id"[MS][Gamble] You now have a total of %i"cash)
        
ColorChat(0,GREEN,"^4[MS][Gamble]^1 Player:^3%s^1 Gambled ^4%i ^1and lost ^4%i ^1of ^3Drpoints ^1!!!",szNamegamblecashcash)
        }
    }
    return 
PLUGIN_HANDLED

not my code, trying to fix it.
Attached Files
File Type: sma Get Plugin or Get Source (deathrun.sma - 460 views - 24.5 KB)

Last edited by Suntox; 11-16-2017 at 10:57.
Suntox is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-16-2017 , 10:06   Re: deathrun exp,grade,point nvault problem
Reply With Quote #2

Untested
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>
#include <colorchat>
#include <engine>


native g_jump(id)
#pragma tabsize 0

#define PLUGIN "dr"
#define VERSION "3.2"
#define AUTHOR "ss"

#define is_valid_player(%1) (1 <= %1 <= 32)

new g_level[32], g_level_datag_frags_levelg_ScreenFade
new g_level_maxg_level_numg_levels[32]
new 
level_exp[32], g_aim_infobuffer[32]
new 
g_level_exp[32], g_Playersnameid[32], g_points[32]
new 
g_trime[32], g_MsgSyncgGrads[32]
new 
sound_level_up[] = { "Level_Up.wav"}
const 
PEV_SPEC_TARGET pev_iuser2
new g_iTarget [33];
new 
g_Lifes[33];

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""150")
    
g_aim_info register_cvar("xp_aim_info""1")
    
g_level_num register_cvar("zp_level_number""1")
    
    
register_clcmd("say /shop""Shop_Items")
    
register_clcmd("say shop""Shop_Items")
    
register_clcmd("say donate""Donate_Menu" );
    
register_clcmd("say /donate""Donate_Menu" );
    
register_clcmd("say /showpoint""ShowPoints" );
    
register_clcmd("say /mypoints""cmd_showgolds" );
    
    
register_concmd("ms_point_""cmd_set"ADMIN_IMMUNITY"<name> <points> - set points to a player" );
    
register_concmd("rs_point_""cmd_reset"ADMIN_IMMUNITY"<name> <points> - reset player points" );
    
    
register_concmd("gamble""CmdGamble"_"usage: gamble <cash>")
    
    
g_level_data nvault_open("Leveling_Save")
    
register_event("HLTV""Round_Start""a""1=0""2=0")
    
register_event("DeathMsg""Frags_Manager""a""1>0"
    
register_event("DeathMsg""eDeath""a")
    
g_ScreenFade get_user_msgid"ScreenFade" )
    
register_event("StatusValue","show_status","b e","1=2","2!0")
    
register_event("StatusValue","hide_status","b e","1=1","2=0")
    
g_Players =get_maxplayers()
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_MsgSync CreateHudSyncObj()
}

public 
plugin_natives() { 
    
    
register_native("get_user_points""native_get_user_points"1); 
    
register_native("set_user_points""native_set_user_points"1);     
}   

public 
native_get_user_points(id

    return 
g_points[id]; 


public 
native_set_user_points(idamount

    
g_points[id] = amount

new const 
Grads[][] =
{
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Noob",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Regular",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Super Bhopper",
"Enemy Killer"
}

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] )
        {
            
1
        
}
    }
}

public 
client_putinserver(id)
{
    if(!
is_user_bot(id) && is_valid_player(id))
        
Level_Load(id)
    
g_level_exp[id] = get_pcvar_num(g_frags_level)
    new 
name[32]
    
g_trime[id] = false;
    
nameid[id] = get_user_name(idnamesizeof name 1)
    if(
is_user_alive(id))
    {
        
g_trime[id] = false;
        new 
1;
        while( 
!= g_level[id] )
        {
            
1;
        }
    }
    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 
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)
    switch(
get_user_team(pid)) 
    { 
        case 
1copy(buffer31"Terrorist"
        case 
2copy(buffer31"Counter-Terrorist"
        } 
    if(
get_pcvar_num(g_aim_info) == 1)
    {
        
set_hudmessage(random_num(200,150),random_num (100,50),random_num(50,25),-1.0,0.60,10.014.00.010.014)
        
show_hudmessage(id"%s^n[ Health : %d | Team : %s ]^n[ Grade : %s | Level : %i | Exp : %i/%i | Dr.Points : %d ]",nameget_user_health(pid), bufferGrads[gGrads[pid]], g_level[pid], level_exp[pid], g_level_exp[pid], g_points[pid])
    }
}

public 
eDeath() 
{
    new 
attacker read_data(1)
    new 
victim read_data(2)
    new 
headshot read_data(3)
    
    if(
get_user_team(attacker) != get_user_team(victim)) 
    {
        
g_points[attacker] += 1
    
}
    
    else
    {
        if(
attacker == victim)
        { 
            
g_points[attacker] += 0
        
}
        
        else
        {
            if(!
headshot)
                
g_points[attacker] += 2
            
else
                
g_points[attacker] += 2
            
        
}
    }
}

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)
    }
    
Level_Save(id)    
    
g_trime[id] = false;
}

public 
level_status(id)
{
    new 
Spec
    Spec 
pev(idPEV_SPEC_TARGET)
    new 
PlayerName[32]
    
get_user_name(SpecPlayerName31)
    switch(
get_user_team(id)) 
    { 
        case 
1copy(buffer31"Terrorist"
        case 
2copy(buffer31"Counter-Terrorist"
        } 
    if(
is_user_alive(id))
    {
        
set_hudmessage(1018010, -1.00.8706.01.1)
        
ShowSyncHudMsg(idg_MsgSync"[ Health : %d | Team : %s ]^n[ Grade : %s | Level : %i | Exp : %i/%i | Dr.Points : %d ]",get_user_health(id), bufferGrads[gGrads[id]], g_level[id], level_exp[id], g_level_exp[id], g_points[id])
    }
    else
        switch(
get_user_team(Spec)) 
    { 
        case 
1copy(buffer31"Terrorist"
            case 
2copy(buffer31"Counter-Terrorist"
        } 
    if(
is_user_alive(Spec))
    {
        
set_hudmessage(20030200, -1.00.7906.01.1)
        
ShowSyncHudMsg(idg_MsgSync"Spectating: %s ^n[ Health : %d | Team : %s ]^n[ Grade : %s | Level : %i | Exp : %i/%i | Dr.Points : %d ]",PlayerNameget_user_health(Spec), bufferGrads[gGrads[id]], g_level[Spec], level_exp[Spec], g_level_exp[Spec], g_points[Spec])
    }
}

public 
Level_Save(id)
{
    new 
vaultkey[64], vaultdata[256]
    new 
AuthID[35
    
get_user_name(id,AuthID,34
    
    
format(vaultkey63"%s-/"AuthID)
    
format(vaultdata255"%i# %i# %d# %s#"g_level[id], level_exp[id], g_points[id], gGrads[id])
    
    
nvault_set(g_level_datavaultkeyvaultdata)
    return 
PLUGIN_CONTINUE;
}

public 
Level_Load(id)
{
    new 
vaultkey[64], vaultdata[256]
    new 
AuthID[35
    
get_user_name(id,AuthID,34
    
    
format(vaultkey63"%s-/"AuthID)
    
format(vaultdata255"%i# %i# %d# %s#"g_level[id], level_exp[id], g_points[id], gGrads[id])
    
    
nvault_get(g_level_datavaultkeyvaultdata255)
    
    
replace_all(vaultdata255"#"" "
    
    new 
givelevel[32], givexp[32], givepoints[32], givegrads[32]
    
parse(vaultdatagivelevel31givexpcharsmax(givexp), givepointscharsmax(givepoints), givegradscharsmax(givegrads))
    
    
g_level[id] = str_to_num(givelevel)
    
level_exp[id] = str_to_num(givexp)
    
g_points[id] = str_to_num(givepoints)
    
    
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))
            
ColorChat(attacker,GREEN,"[MS] ^1You have reached the maximum Level: ^4%i"g_level[attacker])
        
level_exp[attacker] = level_exp[attacker] + 1;
        
Level_Save(attacker);
    }
}

public 
Shop_Items(iPlayer)
{
    new 
szText[555 char]
    
    
formatex(szTextcharsmax(szText), "\r[MS] \yDeathRun Shop \d[\rYour Points : %d\d]^n^n"g_points[iPlayer])
    new 
AdminMenu menu_create(szText"Dr_Shop")
    
    
formatex(szTextcharsmax(szText), "%sRespawn \r[Only Dead] \y[5 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"1"0)
    
    
formatex(szTextcharsmax(szText), "%sInvisibility \r[10 Seconds] \y[15 Dr-Points]"g_points[iPlayer] >= 15 "\w":"\d")
    
menu_additem(AdminMenuszText"2"0)    
    
    
formatex(szTextcharsmax(szText), "%sHealth \r[100 Health] \y[5 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"3"0)
    
    
formatex(szTextcharsmax(szText), "%sFlash Bang \r[] \y[4 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"4"0)
    
    
formatex(szTextcharsmax(szText), "%sSmoke Grenade \r[] \y[4 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"5"0)
    
    
formatex(szTextcharsmax(szText), "%sHe Grenade \r[] \y[4 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"6"0)

    
formatex(szTextcharsmax(szText), "%sMultiJump \r[+1 Jump] \y[6 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"7"0)
    
    
formatex(szTextcharsmax(szText), "%sDesert Eagle \r[7 Bullets] \y[70 Dr-Points]"g_points[iPlayer] >= 70 "\w":"\d")
    
menu_additem(AdminMenuszText"8"0)
    
    
formatex(szTextcharsmax(szText), "%sImmortality \r[10 Seconds] \y[40 Dr-Points]"g_points[iPlayer] >= 40 "\w":"\d")
    
menu_additem(AdminMenuszText"9"0)
    
    
formatex(szTextcharsmax(szText), "%sNoclip \r[2 Seconds] \y[100 Dr-Points]"g_points[iPlayer] >= 100 "\w":"\d")
    
menu_additem(AdminMenuszText"10"0)
    
    
formatex(szTextcharsmax(szText), "%sGlow \r[Random Glow] \y[8 Dr-Points]"g_points[iPlayer] >= "\w":"\d")
    
menu_additem(AdminMenuszText"11"0)
    
    
menu_setprop(AdminMenuMPROP_EXITMEXIT_ALL)
    
menu_display(iPlayerAdminMenu0)
    
    return 
PLUGIN_HANDLED
}

public 
Set_p(id
{
    
g_points[id] += 6000
    g_Lifes
[id] += 600 
}

public 
Dr_Shop(idmenuitem
{  
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdatacharsmax(data), iNamecharsmax(iName), callback )
    new 
key str_to_num(data)
    
    switch(
key)
    {           
        case 
1:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Respawn")
                return 
PLUGIN_HANDLED     
            
}
            if( 
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Dead people can purchase ^3Respawn ^1ability" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"^4[MS] ^1You bought ^3Respawn ^1ability")  
            
ExecuteHamB(Ham_CS_RoundRespawnid)
            
g_points[id] -= 2
        
}
        
        case 
2:
        {
            if( 
g_points[id] < 15 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Invisibility")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Invisibility" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= 15 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Invisibility ^1For^4 10 Seconds")  
            
g_points[id] -= 15
            set_user_footsteps
(id1)
            
set_user_rendering(idkRenderFxNone000kRenderTransAlpha 0)
            
set_user_maxspeed(id,get_user_maxspeed(id) + 500)
            
            
set_task(10.0"Set_Invi",id);
        }
        
        case 
3:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy^3 100 Health")
                return 
PLUGIN_HANDLED     
            
}    
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase^3 100 Health" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 100 ^1Health")  
            
g_points[id] -= 5
            set_user_health
(idget_user_health(id) + 100)
        }        
        
        case 
4:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Flash Bang")
                return 
PLUGIN_HANDLED     
            

            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Flash Bang" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 Flashbang")  
            
g_points[id] -= 4
            give_item 
(id,"weapon_flashbang")
            
cs_set_user_bpammo(idCSW_FLASHBANGcs_get_user_bpammo(idCSW_FLASHBANG) + 1)
        }        
        case 
5:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Smoke Grenade")
                return 
PLUGIN_HANDLED
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Smoke Grenade" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 Smoke grenade")   
            
g_points[id] -= 4
            give_item 
(id,"weapon_smokegrenade")
            
cs_set_user_bpammo(idCSW_SMOKEGRENADEcs_get_user_bpammo(idCSW_SMOKEGRENADE) + 1)
        }
        case 
6:
        {
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3He Grenade")
                return 
PLUGIN_HANDLED
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3He Grenade" )  
                return 
PLUGIN_HANDLED  
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought^4 He Grenade")   
            
g_points[id] -= 4
            give_item 
(id,"weapon_hegrenade")
            
cs_set_user_bpammo(idCSW_HEGRENADEcs_get_user_bpammo(idCSW_HEGRENADE) + 1)
        }
        case 
7:
        {
            
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Multijump")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3 Multijump x1" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"[MS] ^1You Bought ^3Multijump x1")  
            
g_points[id] -= 6
            g_jump
(id)
        }        
        case 
8:
        {
            if( 
g_points[id] < 70 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Deagle")
                return 
PLUGIN_HANDLED
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Deagle" )  
                return 
PLUGIN_HANDLED
            

            else
                if( 
g_points[id] >= 70 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Desert-Eagle")
            
g_points[id] -=8
            give_item
id"weapon_deagle" )
        }        
        case 
9:
        {
            
            if( 
g_points[id] < 40 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Immortality")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Immortality" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= 40 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Immortality ^1For^4 10 Seconds")  
            
g_points[id] -= 40
            set_user_godmode
(id1)
            
set_task(10.0"immort"id)
        }   
        case 
10:
        {
            
            if( 
g_points[id] < 100 )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Noclip")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Noclip" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= 100 )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Noclip ^1For^4 2 Seconds")  
            
g_points[id] -= 100
            set_user_noclip
(id1)
            
set_task(2.0"noc"id)
        }  
        case 
11:
        {
            
            if( 
g_points[id] < )
            {
                
ColorChat(id,GREEN,"^4[MS] ^1You don't have enough ^4Points^1 to buy ^3Glow")
                return 
PLUGIN_HANDLED     
            
}
            if (!
is_user_alive id ))  
            {  
                
ColorChat(id ,GREEN"^4[MS] ^1Only Alive people can purchase ^3Glow" )  
                return 
PLUGIN_HANDLED
            

            else 
                if( 
g_points[id] >= )
                
ColorChat(id,GREEN,"^4[MS] ^1You Bought ^3Random Glow")  
            
g_points[id] -= 8
            set_user_rendering
(idkRenderFxGlowShell,  random_num(0,255),  random_num(0,255),  random_num(0,255), kRenderNormal16 )
        }  
        
    }
    return 
PLUGIN_HANDLED
}

public 
Set_Invi(id)
{
    
ColorChat(id,GREEN,"^4[MS] ^3Invisibility ^1has been removed!")     
    
set_user_footsteps(id0)    
    
set_user_rendering(id0
    return 
PLUGIN_HANDLED


public 
ShowPoints(id)
{
    static 
opcion[64]
    
    
formatex(opcioncharsmax(opcion),"\r[MS] \yShow Players Points :")
    new 
iMenu menu_create(opcion"Handlegolds")
    
    new 
players[32], pnumtempid
    
new szName[32], szTempid[10]
    
    
get_players(playerspnum"ch")
    
    for( new 
ii<pnumi++ )
    {
        
        
tempid players[i]
        
        
get_user_name(tempidszName31)
        
num_to_str(tempidszTempid9)
        
        
formatex(opcion,127,"\w%s \d[ \r%i Points\d ]",szNameg_points[tempid]);
        
menu_additem(iMenuopcionszTempid0)
    }
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
Handlegolds(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], name[64]
    new 
accesscallback
    
    menu_item_getinfo 
(menuitemaccessdata5name63callback)
    new 
tempid str_to_num (data)
    
    new 
szName[33], szPlayerName[33]
    
    
get_user_name(idszName32)
    
get_user_name(tempidszPlayerName32)
    
    
ColorChat(idRED"^4[MS] ^1Player ^3%s ^1has ^3%i ^4Drpoints ^1!",szPlayerNameg_points[tempid])
    
    
ShowPoints(id);
    
    return 
PLUGIN_CONTINUE
}


public 
Donate_Menu(id)
{
    new 
iMenu menu_create("\r[MS] \yDonate Players Menu""handleDonate");
    
    new 
iPlayers[32], szName[32], szKey[3], iNumiPlayer;
    
get_players(iPlayersiNum,"ch");
    
    for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
get_user_name(iPlayerszNamecharsmax(szName));
        
        
menu_additem(iMenuszNameszKey);
    }
    
    
menu_setprop(iMenuMPROP_EXITNAME"Back");
    
menu_display(idiMenu0);
    return 
0;
}


public 
handleDonate(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData[6], iAccessiCallback;
    
menu_item_getinfo(menuitemiAccessszDatacharsmax(szData), __iCallback);
    
    
g_iTarget[id] = str_to_num(szData);
    new 
szName[32];
    
get_user_name(g_iTarget[id], szNamecharsmax(szName));
    
    
client_cmd(id"messagemode Donate");
    return 
PLUGIN_HANDLED;
}


public 
CmdDonate(id)
{
    new 
szArg[5];
    
read_argv(1szArgcharsmax(szArg));
    
    
    new 
iValue str_to_num(szArg);
    
    if( 
iValue g_points[id] )
    {
        
ColorChat(id,GREEN"^4[MS] ^1You only have ^3%i ^4Drpoints ^1!",g_points[id]);
        return 
PLUGIN_HANDLED;
    }
    
    new 
iTarget g_iTarget[id];
    
    if( !
iTarget )
    {
        return 
PLUGIN_HANDLED;
    }
    
    if( 
iTarget == id )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
g_points[id] -= iValue;
    
    
g_points[iTarget] += iValue;
    
    new 
szName[2][32];
    
get_user_name(iTargetszName[0], charsmax(szName[]));
    
get_user_name(idszName[1], charsmax(szName[]));
    
    
ColorChat(id,GREEN"^4[MS] ^1You donated ^3%i^4Drpoints ^1to ^3%s ^1!"iValueszName[0]);
    
ColorChat(iTarget,GREEN"^4[MS] ^3%s^1 sent you ^3%i ^4Drpoints"szName[1], iValue);
    
    
    return 
PLUGIN_HANDLED;
}


public 
cmd_showgolds(id)
{    
    
set_hudmessage(02552550.00.8706.012.0)
    
show_hudmessage(id"You Have %d Points"g_points [id] )
    
    
ColorChatidGREEN"^4[MS] ^1You have ^3%d ^4Drpoints ^1!"g_pointsid ] );    
}


public 
cmd_set(id,level,cid)
{
    if ( !(
get_user_flags(id) & ADMIN_IMMUNITY) )
        return 
PLUGIN_HANDLED
    
    
else
    {
        new 
target[32], pid
        read_argv
(1,target,31)
        
pid cmd_target(id,target,2)
        
        new 
amountstr[10], amount
        read_argv
(2,amountstr,9)
        
amount str_to_num(amountstr)
        
        new 
name[32], tname[32]
        
get_user_name(id,name,31)
        
get_user_name(pid,tname,31)
        
        
g_points[pid] += amount
        ColorChat
(idGREEN"^4[MS] ^1You sent ^3%d ^4Drpoints ^1to ^3%s ^1!"amounttname)
        
ColorChat(pidGREEN"^4[MS] ^1Admin ^3%s ^1sent ^3%d ^4Drpoints ^1to you, Now you have ^3%d ^4Drpoints ^1!"nameamount,g_points[pid])
    }    
    return 
PLUGIN_HANDLED
}


public 
cmd_reset(id,level,cid)
{
    if ( !(
get_user_flags(id) & ADMIN_IMMUNITY) )
        return 
PLUGIN_HANDLED
        
    
else
    {
        new 
target[32], pid
        read_argv
(1,target,31)
        
pid cmd_target(id,target,2)
        
        new 
amountstr[10], amount
        read_argv
(2,amountstr,9)
        
amount str_to_num(amountstr)
        
        new 
name[32], tname[32]
        
get_user_name(id,name,31)
        
get_user_name(pid,tname,31)
        
        if((
g_points[pid] -= amount) < 0)
            
        
amount g_points[pid]
        
        
g_points[pid] -= amount
        ColorChat
(idGREEN"^4[MS] ^1You removed ^3%d ^4Drpoints ^1from ^3%s ^1!"amounttname)
        
ColorChat(pidGREEN"^4[MS] ^1Admin ^3%s ^1removed from you ^3%d ^4Drpoints ^4! ^1Now you have ^3%d ^4Drpoints ^1!"nameamount,g_points[pid])
    }
    return 
PLUGIN_HANDLED
    
}

public 
immort(id) {
    if(
is_user_alive(id))
    {
        
set_user_godmode(id0)
        
ColorChat(idGREEN"^4[MS] ^3Immortality ^1has been removed!")
    }
}

public 
noc(id) {
    if(
is_user_alive(id))
    {
        
set_user_noclip(id0)
        
ColorChat(idGREEN"^4[MS] ^3Noclip ^1has been removed!")
    }
}
public 
glow(id) {
    if (!
is_user_alive(id))
    {
        
set_user_renderingidkRenderFxNone000kRenderNormal)
    }
}

public 
CmdGamble(id) {
    new 
cash native_get_user_points(id)
    new 
szName[32]
    
    if(
cash 10) {
        
console_print(id"[MS][Gamble] You need at least 10 DrPoints to gamble.")
        
ColorChat(id,GREEN,"^4[MS][Gamble]^1 You need at least^4 10 ^3DrPoints^1 to gamble.")
        return 
PLUGIN_HANDLED
    
}
    
    else {
        new 
argv[35], gamblecash
        read_argv
(1argvcharsmax(argv))
        
gamblecash str_to_num(argv)
        
        if(
gamblecash 10) {
            
console_print(id"[MS][Gamble] You need to gamble at least 10 Drpoints")
            
ColorChat(id,GREEN,"^4[MS][Gamble]^1 You need to gamble at least^4 10 ^3Drpoints")
            return 
PLUGIN_HANDLED
        
}
        
        if(
cash gamblecash) {
            
console_print(id"[MS][Gamble] You only have %i Drpoints"cash)
        
ColorChat(id,GREEN"^4[MS][Gamble]^1 You only have ^4%i^3Drpoints"cash)
            return 
PLUGIN_HANDLED
        
}
        
        new 
dice random_num(1100)
        
        if(
dice 52) {
            
native_set_user_points(idcash += gamblecash)
            
console_print(id"[MS][Gamble] Congratulations, you won a total of %i Drpoints"gamblecash)
            
console_print(id"[MS][Gamble] You now have a total of %i"cash)
        
ColorChat(0,GREEN,"^4[MS][Gamble]^1 Player:^3%s^1 Gambled ^4%i ^1and won ^4%i ^1of ^3Drpoints ^1!!!",szNamegamblecashcash)
        }
        
        else if(
dice 48) {
            
native_set_user_points(idcash -= gamblecash)
            
console_print(id"[MS][Gamble] Oh no... You lost %i cash"gamblecash)
            
console_print(id"[MS][Gamble] You now have a total of %i"cash)
        
ColorChat(0,GREEN,"^4[MS][Gamble]^1 Player:^3%s^1 Gambled ^4%i ^1and lost ^4%i ^1of ^3Drpoints ^1!!!",szNamegamblecashcash)
        }
    }
    return 
PLUGIN_HANDLED

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Suntox
Member
Join Date: Nov 2016
Old 11-16-2017 , 10:57   Re: deathrun exp,grade,point nvault problem
Reply With Quote #3

works fine
thanks @Napoleon_be
Suntox is offline
Reply


Thread Tools
Display Modes

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 04:23.


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