Raised This Month: $ Target: $400
 0% 

GunXp Skill Menu Save Fix.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 04-01-2017 , 12:25   GunXp Skill Menu Save Fix.
Reply With Quote #1

Hi i have converted my prestige shop to skill menu but i want people who buy items from skill they get saved as it show in code so can any one make them save by days like it show? and thanx!

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <gunxpmod>

new PlayerItems[33]
new 
ItemFille[33]

public 
plugin_init() {
    
register_plugin("Skill Prs Shop""1.1""DeXTeR")
    
    new 
DataDir[64]
    
get_datadir(DataDir63)
    
format(ItemFille127"%s/Items.dat"DataDir)
    
    
register_clcmd("say /skill""CmdSkillMenu");    
    
register_clcmd("say skill""CmdSkillMenu");
    
    
set_task(0.5"TASK_HUD"___"b")
}

public 
client_putinserver(id) {
    
LoadItems(id)
}

public 
client_connect(id) {
    
LoadItems(id)
}

public 
client_disconnect(id) {
    
SaveItems(id)
}

public 
CmdSkillMenu(id) {
    new 
Title[128], Menu
    formatex
(Titlesizeof(Title)-1"\r[\yGunXP\r] \wSkill Shop^n\yAvailable Prestige: \r%d"get_user_prestige(id))
    
Menu menu_create(Title"CmdBuyItems")
    
    if(
get_user_prestige(id) >= 1
        
menu_additem(Menu"\w1 Parachute (18 Days) - \y(\r Need 1 Prestige\y)""1"0)
    else 
        
menu_additem(Menu"\d1 Parachute (18 Days) - \y(\rNeed 1 Prestige\y)""1"0)
        
    if(
get_user_prestige(id) >= 2)
        
menu_additem(Menu"\w3 Speed (3 Days) - \y(\rNeed 2 Prestige\y)""2"0)
    else 
        
menu_additem(Menu"\d3 Speed (3 Days) - \y(\rNeed 2 Prestige\y)""2"0)
        
    if(
get_user_prestige(id) >= 3
        
menu_additem(Menu"\w5 Multi-Jumb (14 Days) - \y(\rNeed 3 Prestige\y)""3"0)
    else 
        
menu_additem(Menu"\d5 Multi-Jumb (14 Days) - \y(\rNeed 3 Prestige\y)""3"0)        

    if(
get_user_prestige(id) >= 4
        
menu_additem(Menu"\w10 Sand-Bags (5 Days) - \y(\rNeed 4 Prestige\y)""4"0)
    else 
        
menu_additem(Menu"\d10 Sand-Bags (5 Days) - \y(\rNeed 4 Prestige\y)""4"0)
        
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL);
    
menu_display(idMenu0);
}

public 
CmdBuyItems(idmenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
Data[6], Name[64];
    new 
AccessCallBack;
    
menu_item_getinfo(menuitemAccessData,5Name63CallBack);
    new 
Key str_to_num(Data);
    switch(
Key) {
        case 
1: {
            new 
ItemCost get_user_prestige(id) - 1
            
if(ItemCost 0
                
ColorChat(id"!t[GunXP]!y You dont have enought !tPrs!n to buy !gparachute !")
            else {
                
// item give
                
set_user_prestige(idItemCost)
                
ColorChat(id"!t[GunXP]!1 You buyed !gparachute 18 days !")
            }
        }
        case 
2: {
            new 
ItemCost get_user_prestige(id) - 2
            
if(ItemCost 0
                
ColorChat(id"!t[GunXP]!y You dont have enought !tPrs!n to buy !gspeed !")
            else {
                
// item give
                
set_user_prestige(idItemCost)
                
ColorChat(id"!t[GunXP]!1 You buyed !gspeed !")
            }
        }
        case 
3: {
            new 
ItemCost get_user_prestige(id) - 3
            
if(ItemCost 0
                
ColorChat(id"!t[GunXP]!y You dont have enought !tPrs!n to buy  !gmulti-jumb !")
            else {
                
// item give
                
set_user_prestige(idItemCost)
                
ColorChat(id"!t[GunXP]!1 You buyed !gmulti-jumb !")
            }
        }
        case 
4: {
            new 
ItemCost get_user_prestige(id) - 4
            
if(ItemCost 0
                
ColorChat(id"!t[GunXP]!y You dont have enought !tPrs!n to buy !gsand-bags !")
            else {
                
// item give 
                
set_user_prestige(idItemCost)
                
ColorChat(id"!t[GunXP]!1 You buyed !gsand-bags !")
            }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

// Save Items
public SaveItems(id) {
    if(!
is_user_connected(id)) return 1;
    new 
Name[32];
    
get_user_name(idName31);
    
    static 
Data[1024]
    
formatex(Datasizeof(Data) - 1"^"%i^""PlayerItems[id])
    
    new 
Save[512]
    
format(Save511"^"%s^" %s"NameData)
    
    new 
Line[128], LinieIsPlayer falseArg1[32]
    
    new 
FileOpen fopen(ItemFille"rt")
    while(!
feof(FileOpen)) {
        
fgets(FileOpenLine127)
        
trim(Line)
        
        
parse(LineArg131)
        
        if (
equali(Arg1Name)) {
            
write_file(ItemFilleSaveLinie)
            
IsPlayer true
            
break
        }
        
        
Linie++
    }
    
fclose(FileOpen)
    if (!
IsPlayer) {
        
write_file(ItemFilleSave, -1)
    }
    return 
PLUGIN_HANDLED
}

// Load Items
public LoadItems(id) {
    if(!
is_user_connected(id))     return 1;
    new 
Name[32];
    
get_user_name(idName31);
    
    new 
Line[128], Arg1[32], Arg2[32];
    
    new 
FileOpen fopen(ItemFille"rt")
    while(!
feof(FileOpen)) {
        
fgets(FileOpenLine127)
        
trim(Line)
        
        
parse(LineArg131Arg231)
        
        if (
equali(Arg1Name)) {
            
PlayerItems[id] = str_to_num(Arg2)
            break
        }
    }
    
fclose(FileOpen)
    return 
PLUGIN_HANDLED
}

stock ColorChat(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();
            }
        }
    } 

__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Mr.J
Senior Member
Join Date: Sep 2017
Location: cs_assault
Old 09-14-2017 , 04:18   Re: GunXp Skill Menu Save Fix.
Reply With Quote #2

Plz make SMA file and upload it and i will try to solve that problem
Mr.J is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-14-2017 , 14:03   Re: GunXp Skill Menu Save Fix.
Reply With Quote #3

Quote:
Originally Posted by Mr.J View Post
Plz make SMA file and upload it and i will try to solve that problem
you are joking right?
__________________
retired chump
DjSoftero is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 09-14-2017 , 16:01   Re: GunXp Skill Menu Save Fix.
Reply With Quote #4

Quote:
Originally Posted by DjSoftero View Post
you are joking right?
i gess 100% he jocking -_-
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Mr.J
Senior Member
Join Date: Sep 2017
Location: cs_assault
Old 09-17-2017 , 09:12   Re: GunXp Skill Menu Save Fix.
Reply With Quote #5

U didnt understand my amxx wont compile PHP codes
Mr.J is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 09-17-2017 , 09:59   Re: GunXp Skill Menu Save Fix.
Reply With Quote #6

And U didn't even notice that the thread from 1 Apr.
__________________
Ayman Khaled is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-17-2017 , 12:41   Re: GunXp Skill Menu Save Fix.
Reply With Quote #7

Quote:
Originally Posted by Mr.J View Post
U didnt understand my amxx wont compile PHP codes
if he put the code in php doesnt mean the code is written in php. I myself put code in php tags aswell.
__________________
retired chump
DjSoftero is offline
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 08:19.


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