Raised This Month: $ Target: $400
 0% 

Case and Keys problem (need make save)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ray Brown
Junior Member
Join Date: May 2018
Old 05-31-2018 , 13:22   Case and Keys problem (need make save)
Reply With Quote #1

Good day, guys ! Need your help

In general, this is the problem: i found a plugin on the Internet and in this plugin there are still keys for opening cases and the essence of something is that after leaving the server, these keys are reset to 0, and I need to save or after logging out of the server and change the card

It is possible to make saving this information about player and how many keys he have in .txt file in folder "data" ?

PHP Code:
#pragma tabsize 0

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define Get_User_Admin(%0) (get_user_flags(%0) & ADMIN_IMMUNITY)

new Bilet[33]
new const 
serverIP[] = "178.170.189.218:27031";

public 
plugin_init()
{

    new 
szIp[33];
    
get_user_ip0szIpcharsmax(szIp));
    if(!
equal(szIpserverIP))
    {
        
server_print("IP false");
        
set_fail_state("This plugin is private. Buy plugin vk.com/ray.brown"); 
    }
    
server_print("The plugin was successfully activated");
    
    
register_logevent("RoundStart"2"1=Round_Start");
    
    
register_menucmd(register_menuid("PL_HackedMenu"), (1<<0|1<<1|1<<2|1<<3|1<<9),       "Handle_HackedMenu")
    
register_menucmd(register_menuid("PL_BuyBilet"),   (1<<0|1<<1|1<<9),                 "Handle_BuyBilet")
    
register_menucmd(register_menuid("PL_BiletMenu"),  (1<<0|1<<1|1<<2|1<<3|1<<4|1<<9),  "Handle_BiletMenu")
    
}

public 
plugin_natives()
{
    
register_native("open_menucaseserver""menu_caseserver"1)
}

public 
client_putinserver(idBilet[id] = 1

public RoundStart()
{
    for(new 
id 1id <= get_maxplayers(); id++)
    {   
        if(
Get_User_Admin(id))
        {
            
Bilet[id] = Bilet[id] + 1
            ChatColor
(id"!y[!gАльфа!y] !tВы получили !g1 !tключ за донат")
        }
        else 
Bilet[id] = Bilet[id] + 1
    
}
}

public 
menu_caseserver(id) return PL_HackedMenu(id)

PL_HackedMenu(id)
{
    new 
menu[1024]
    new 
iKeys = (1<<2|1<<9)
    new 
len formatex(menucharsmax(menu), "\d~ \rWARGLORY \d| \wАльфа \d~^n\yГруппа\d: \rvk.com/warglory^n\r~ \d| \wВаши ключи\d: \y%d^n^n"Bilet[id])
    
    if(
Bilet[id] >= 20)
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r1. \wКейс Прорыв \d- \r20 \wключей \d| \wПриз\d: \yПатруль^n")
        
iKeys |= (1<<0);
    }
    else 
len += formatex(menu[len], charsmax(menu) - len"\r1. \dКейс Прорыв - 20 ключей | Приз: Патруль^n")
    
    if(
Bilet[id] >= 10)
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r2. \wКейс Феникс \d- \r10 \wключей \d| \wПриз\d: \yЗвание+Скины^n^n")
        
iKeys |= (1<<1);
    }
    else 
len += formatex(menu[len], charsmax(menu) - len"\r2. \dКейс Феникс - 10 ключей | Приз: Звание+Скины^n^n")
    
len += formatex(menu[len], charsmax(menu) - len"\r3. \wКупить ключи^n")
    
    if(
Get_User_Admin(id))
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r4. \wМеню ключей \d| \rПатруль^n^n")
        
iKeys |= (1<<3)
    }
    else 
len += formatex(menu[len], charsmax(menu) - len"\r4. \dМеню ключей | Патруль^n^n")
    
    
formatex(menu[len], charsmax(menu) - len"\r0. \wЗакрыть")
    return 
show_menu(idiKeysmenu, -1"PL_HackedMenu")
}

public 
Handle_HackedMenu(idiKey)
{
    switch(
iKey)
    {
        case 
0:
        {
            new 
iHackedGo random_num1)
            switch(
iHackedGo)
            {
                case 
1ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв")
                case 
2ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв")
                case 
3ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв")
                case 
4ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв")
            }
            
Bilet[id] = Bilet[id] - 20
        
}
        case 
1:
        {
            new 
iHackedGo random_num1)
            switch(
iHackedGo)
            {
                case 
1ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс")
                case 
2ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс")
                case 
3ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс")
                case 
4ChatColor(id"!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс")
            }
            
Bilet[id] = Bilet[id] - 10
        
}
        case 
2: return PL_BuyBilet(id)
        case 
3: return PL_BiletMenu(id)
    }
    return 
PLUGIN_HANDLED;
}

PL_BuyBilet(id)
{
    new 
menu[1024]
    new 
iKeys = (1<<2|1<<8|1<<9)
    new 
len formatex(menucharsmax(menu), "\d~ \rWARGLORY \d| \wАльфа \d~^n\yГруппа\d: \rvk.com/warglory^n\r~ \d| \wВаши деньги\d: \y%d^n^n"cs_get_user_money(id))
    
    if(
cs_get_user_money(id) >= 10000)
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r1. \wКупить \r1 \wключ \d| \y10000\d$^n")
        
iKeys |= (1<<0);
    }
    else 
len += formatex(menu[len], charsmax(menu) - len"\r1. \dКупить 1 ключ | 10000$^n")
    if(
cs_get_user_money(id) >= 16000)
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r2. \wКупить \r3 \wключа \d| \y16000\d$^n^n")
        
iKeys |= (1<<1);
    }
    else 
len += formatex(menu[len], charsmax(menu) - len"\r2. \dКупить 3 ключа | 16000$^n^n")
    
    
formatex(menu[len], charsmax(menu) - len"\r0. \wЗакрыть")
    return 
show_menu(idiKeysmenu, -1"PL_BuyBilet")
}

public 
Handle_BuyBilet(idiKey)
{
    switch(
iKey)
    {
        case 
0
        {
            
cs_set_user_money(idcs_get_user_money(id) - 100001)
            
Bilet[id] = Bilet[id] + 1
            ChatColor
(id"!y[!gАльфа!y] !tВы успешно купили !g1 !tключ")
        }
        case 
1:
        {
            
cs_set_user_money(idcs_get_user_money(id) - 160001)
            
Bilet[id] = Bilet[id] + 3
            ChatColor
(id"!y[!gАльфа!y] !tВы успешно купили !g3 !tключа")
        }
        case 
8: return PL_HackedMenu(id)
        case 
9: return PLUGIN_HANDLED
    
}
    return 
PL_HackedMenu(id)
}

PL_BiletMenu(id)
{
    new 
menu[1024]
    new 
iKeys = (1<<0|1<<1|1<<2|1<<3|1<<8|1<<9)
    new 
len formatex(menucharsmax(menu), "\d~ \rWARGLORY \d| \wАльфа \d~^n\yГруппа\d: \rvk.com/warglory^n^n")
    
    
len += formatex(menu[len], charsmax(menu) - len"\r1. \wВзять \r1 \wключ^n")
    
len += formatex(menu[len], charsmax(menu) - len"\r2. \wВзять \r5 \wключей^n")
    
len += formatex(menu[len], charsmax(menu) - len"\r3. \wВзять \r10 \wключей^n")
    
len += formatex(menu[len], charsmax(menu) - len"\r4. \wВзять \r20 \wключей^n^n")
    
    
formatex(menu[len], charsmax(menu) - len"\r0. \wЗакрыть")
    return 
show_menu(idiKeysmenu, -1"PL_BiletMenu")
}

public 
Handle_BiletMenu(idiKey)
{
    switch(
iKey)
    {
        case 
0
        {
            
Bilet[id] = Bilet[id] + 1
            ChatColor
(id"!y[!gАльфа!y] !tВы успешно взяли !g1 !tключ")
        }
        case 
1:
        {
            
Bilet[id] = Bilet[id] + 5
            ChatColor
(id"!y[!gАльфа!y] !!tВы успешно взяли !g5 !tключей")
        }
        case 
2
        {
            
Bilet[id] = Bilet[id] + 10
            ChatColor
(id"!y[!gАльфа!y] !tВы успешно взяли !g10 !tключей")
        }
        case 
3:
        {
            
Bilet[id] = Bilet[id] + 20
            ChatColor
(id"!y[!gАльфа!y] !tВы успешно взяли !g20 !tключей")
        }
        case 
8: return PL_HackedMenu(id)
        case 
9: return PLUGIN_HANDLED
    
}
    return 
PL_BiletMenu(id)
}

stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

Attached Files
File Type: sma Get Plugin or Get Source (caseserver.sma - 539 views - 7.8 KB)

Last edited by Ray Brown; 05-31-2018 at 13:32.
Ray Brown is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 05-31-2018 , 14:16   Re: Case and Keys problem (need make save)
Reply With Quote #2

If you need to save SteamID - some value, simply use nvault.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Reply



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 18:02.


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