Raised This Month: $ Target: $400
 0% 

BUY VIP 1H/2H by Your Points [ HELP Pls ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Algeria
Old 06-30-2022 , 20:51   BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #1

Hi guys!
i want this plugin just some edits
I want when someone say /Shop or /sp , he will see a menu shop
SHOP MENU :
/r1. /wBUY VIP FOR 1 HOUR /r400Pts
/r2. /wBUY VIP FOR 2 HOUR /r650Pts.


That's it guys

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <point_system>

new g_iBlinkAcct

new const VERSION[] = "1.0"

// CT items
new szCTItems[][]=
{
    
"M249 Gun",
    
"10000$ Money",
    
"5000$ Money",
    
"50 HP",
    
"50 AP",
    
"He-Grenade"

}

// TR Items
new szTRItems[][]=
{
    
"10000$ Money",
    
"5000$ Money",
    
"He-Grenade",
    
"50 HP",
    
"50 AP" 
}

// CT items price (point)
new g_szCostCT[] =
{
    
50,
    
40,
    
20,
    
15,
    
5,
    
10
}
// TR Items price (point)
new g_szCostTR[] =
{
    
40,
    
20,
    
10,
    
15,
    
5
}

public 
plugin_init()
{
    
register_plugin("Point Shop"VERSION"LearninG")
    
// register a way to open menu
    
register_clcmd("say /sp""shop")
    
register_clcmd("say_team /sp" "shop")
    
register_clcmd("say /shop""shop")
    
register_clcmd("say_team /shop""shop")
}

// show them a menu based on their team
public shop(id
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_CT:
        {
            
menu_ct(id)
        }
        case 
CS_TEAM_T:
        {
            
menu_t(id)
        }
    }
}

// CT's menu
public menu_ct(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Points: \g %d"point); 
    new 
menu menu_create(Temp"handler_ct"

    new 
szItemName[64
    for(new 
ii<sizeof szCTItems && i<sizeof g_szCostCTi++) 
    {
        if( 
point g_szCostCT[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szCTItems], g_szCostCT])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s\y(%d)"szCTItems], g_szCostCT])
        }
        
menu_additem(menu szItemName)
    }
    
menu_display(id menu 0)
}

// TR's menu
public menu_t(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Point:\y %d"point)
    new 
menu menu_create(Temp"handler_t"


    new 
szItemName[64]
    for(new 
ii<sizeof szTRItems && i<sizeof g_szCostTRi++)
    {
        if( 
point g_szCostTR[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szTRItems], g_szCostTR])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s \y(%d)"szTRItems], g_szCostTR])
        }
        
menu_additem(menu szItemName)
    }
    
menu_display(id menu 0)
}

// CT menu handler
public handler_ct(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostCT[item]   

    if( 
point g_szCostCT[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    

    switch(
item
    {
        case 
0:
        {
            
give_item(id "weapon_m249")
            
cs_set_user_bpammo(id CSW_M249 200)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
        case 
5:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 
}

// TR menu hadnler
public handler_t(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostTR[item]   

    if( 
point g_szCostTR[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    

    switch(
item
    {
        case 
0:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 


// Show them a message when they don't have enough money
NotEnoughMoneyid 

    
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money")

    
message_begin(MSG_ONE_UNRELIABLEg_iBlinkAcct, .player=id)
    { 
        
write_byte(2)
    } 
    
message_end() 

Print chat when u bought a vip 1h or /2h
!g[Shop] !t%s !yJust Bought VIP for !g%s Hour.
EVERYONE can see this chat
__________________
Thanks you

Last edited by SHIFT0; 06-30-2022 at 20:53.
SHIFT0 is offline
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Algeria
Old 07-02-2022 , 19:45   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #2

some one help
__________________
Thanks you
SHIFT0 is offline
lexzor
Senior Member
Join Date: Nov 2020
Old 07-02-2022 , 23:30   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #3

give this include
PHP Code:
#include <point_system> 
lexzor is online now
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Algeria
Old 07-03-2022 , 09:39   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #4

Quote:
Originally Posted by lexzor View Post
give this include
PHP Code:
#include <point_system> 
ok
Attached Files
File Type: inc point_system.inc (717 Bytes, 6 views)
__________________
Thanks you
SHIFT0 is offline
lexzor
Senior Member
Join Date: Nov 2020
Old 07-03-2022 , 13:20   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <point_system>
#include <nvault>

#define TAG "^4[TAG]^1"
#define VIP_EXPIRED_MSG_FLOAT 10.0
#define ONE_HOUR_FLAG "t"
#define TWO_HOUR_FLAG "n"

new g_iBlinkAcct
new g_iVIPLevel[MAX_PLAYERS 1];

new const 
VERSION[] = "1.0"

new g_nVault;

// CT items
new szCTItems[][]=
{
    
"M249 Gun",
    
"10000$ Money",
    
"5000$ Money",
    
"50 HP",
    
"50 AP",
    
"He-Grenade"

}

// TR Items
new szTRItems[][]=
{
    
"10000$ Money",
    
"5000$ Money",
    
"He-Grenade",
    
"50 HP",
    
"50 AP" 
}

// CT items price (point)
new g_szCostCT[] =
{
    
50,
    
40,
    
20,
    
15,
    
5,
    
10
}
// TR Items price (point)
new g_szCostTR[] =
{
    
40,
    
20,
    
10,
    
15,
    
5
}

public 
plugin_init()
{
    
register_plugin("Point Shop"VERSION"LearninG")
    
// register a way to open menu
    
register_clcmd("say /sp""shop")
    
register_clcmd("say_team /sp" "shop")
    
register_clcmd("say /shop""shop")
    
register_clcmd("say_team /shop""shop")

    
g_nVault nvault_open("temp_vip");

    if(
g_nVault == INVALID_HANDLE)
        
set_fail_state("error  in opening vip nvualt")
}

public 
plugin_end()
{
    
nvault_close(g_nVault);
}

// show them a menu based on their team
public shop(id
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_CT:
        {
            
menu_ct(id)
        }
        case 
CS_TEAM_T:
        {
            
menu_t(id)
        }
    }
}

public 
client_authorized(id)
{
    
g_iVIPLevel[id] = -1;
    
check_user(id);
}

public 
check_user(id)
{
    new 
szName[33]
    
get_user_name(idszName32);

    new 
itsszData[15];

    if(
nvault_lookup(g_nVaultszNameszDatacharsmax(szData), its))
    {
        new 
szLevel[15];
        new 
szTime[15];

        
parse(szDataszTimecharsmax(szTime), szLevelcharsmax(szLevel));

        if(
str_to_num(szTime) <= get_systime())
        {
            
g_iVIPLevel[id] = -1;
            
set_task(VIP_EXPIRED_MSG_FLOAT"msgexpired"id 12345);
            return 
PLUGIN_CONTINUE;
        } else 
g_iVIPLevel[id] = str_to_num(szLevel);

        switch(
g_iVIPLevel[id])
        {
            case 
0set_user_flags(idread_flags(ONE_HOUR_FLAG));
            case 
1set_user_flags(idread_flags(TWO_HOUR_FLAG));
        }
    }

    return 
PLUGIN_CONTINUE;
}

public 
msgexpired(id)
{
    
id -= 12345;
    
client_print_color(idprint_team_default"%s Your VIP^4 expired^1!"TAG);
}

// CT's menu
public menu_ct(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Points: \g %d"point); 
    new 
menu menu_create(Temp"handler_ct"

    new 
szItemName[64
    for(new 
ii<sizeof szCTItems && i<sizeof g_szCostCTi++) 
    {
        if( 
point g_szCostCT[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szCTItems], g_szCostCT])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s\y(%d)"szCTItems], g_szCostCT])
        }
        
menu_additem(menu szItemName)
    }
    
menu_additem(menu"/wBUY VIP FOR 1 HOUR /r400Pts""vip_1");
    
menu_additem(menu"/wBUY VIP FOR 2 HOUR /r650Pts""vip_2");

    
menu_display(id menu 0)
}

// TR's menu
public menu_t(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Point:\y %d"point)
    new 
menu menu_create(Temp"handler_t"


    new 
szItemName[64]
    for(new 
ii<sizeof szTRItems && i<sizeof g_szCostTRi++)
    {
        if( 
point g_szCostTR[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szTRItems], g_szCostTR])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s \y(%d)"szTRItems], g_szCostTR])
        }
        
menu_additem(menu szItemName)
    }

    
menu_additem(menu"/wBUY VIP FOR 1 HOUR /r400Pts""vip_1");
    
menu_additem(menu"/wBUY VIP FOR 2 HOUR /r650Pts""vip_2");

    
menu_display(id menu 0)
}

// CT menu handler
public handler_ct(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostCT[item]   

    if( 
point g_szCostCT[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    


    new 
szData[10];
    
menu_item_getinfo(menuitem_szDatacharsmax(szData), ___);

    if(
equali(szData"vip_1"))
    {
        
give_vip(id0);
        return 
PLUGIN_HANDLED;
    }
    
    if(
equali(szData"vip_2"))
    {
        
give_vip(id1);
        return 
PLUGIN_HANDLED;
    }

    switch(
item
    {
        case 
0:
        {
            
give_item(id "weapon_m249")
            
cs_set_user_bpammo(id CSW_M249 200)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
        case 
5:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 
}

give_vip(idvip_type)
{
    switch(
g_iVIPLevel[id])
    {
        case -
1:
        {
            new 
iTime;
            switch(
vip_type)
            {
                case 
0iTime get_systime(3600);
                case 
1iTime get_systime(7200);
            }

            new 
szKey[MAX_AUTHID_LENGTH];
            
get_user_authid(idszKeycharsmax(szKey));
            new 
szData[64];
            
g_iVIPLevel[id] = vip_type;
            
formatex(szDatacharsmax(szData), "%i %i"vip_typeiTime);
            
set_user_flags(idvip_type == read_flags(ONE_HOUR_FLAG) : read_flags(TWO_HOUR_FLAG));
            
nvault_set(g_nVaultszKeyszData);
        }

        case 
0..1
        {
            
client_print_color(idprint_team_default"%s You already have^3 %i Hour%s VIP^1."TAG,
            
g_iVIPLevel[id] == "1" "2"g_iVIPLevel[id] > "s" "");
        }
    }
}

// TR menu hadnler
public handler_t(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostTR[item]   

    if( 
point g_szCostTR[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    


    new 
szData[10];
    
menu_item_getinfo(menuitem_szDatacharsmax(szData), ___);

    if(
equali(szData"vip_1"))
    {
        
give_vip(id0);
        return 
PLUGIN_HANDLED;
    }
    
    if(
equali(szData"vip_2"))
    {
        
give_vip(id1);
        return 
PLUGIN_HANDLED;
    }

    switch(
item
    {
        case 
0:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 


// Show them a message when they don't have enough money
NotEnoughMoneyid 

    
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money")

    
message_begin(MSG_ONE_UNRELIABLEg_iBlinkAcct, .player=id)
    { 
        
write_byte(2)
    } 
    
message_end() 

try this one, not tested
lexzor is online now
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Algeria
Old 07-04-2022 , 10:35   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #6

Quote:
Originally Posted by lexzor View Post
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <point_system>
#include <nvault>

#define TAG "^4[TAG]^1"
#define VIP_EXPIRED_MSG_FLOAT 10.0
#define ONE_HOUR_FLAG "t"
#define TWO_HOUR_FLAG "n"

new g_iBlinkAcct
new g_iVIPLevel[MAX_PLAYERS 1];

new const 
VERSION[] = "1.0"

new g_nVault;

// CT items
new szCTItems[][]=
{
    
"M249 Gun",
    
"10000$ Money",
    
"5000$ Money",
    
"50 HP",
    
"50 AP",
    
"He-Grenade"

}

// TR Items
new szTRItems[][]=
{
    
"10000$ Money",
    
"5000$ Money",
    
"He-Grenade",
    
"50 HP",
    
"50 AP" 
}

// CT items price (point)
new g_szCostCT[] =
{
    
50,
    
40,
    
20,
    
15,
    
5,
    
10
}
// TR Items price (point)
new g_szCostTR[] =
{
    
40,
    
20,
    
10,
    
15,
    
5
}

public 
plugin_init()
{
    
register_plugin("Point Shop"VERSION"LearninG")
    
// register a way to open menu
    
register_clcmd("say /sp""shop")
    
register_clcmd("say_team /sp" "shop")
    
register_clcmd("say /shop""shop")
    
register_clcmd("say_team /shop""shop")

    
g_nVault nvault_open("temp_vip");

    if(
g_nVault == INVALID_HANDLE)
        
set_fail_state("error  in opening vip nvualt")
}

public 
plugin_end()
{
    
nvault_close(g_nVault);
}

// show them a menu based on their team
public shop(id
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_CT:
        {
            
menu_ct(id)
        }
        case 
CS_TEAM_T:
        {
            
menu_t(id)
        }
    }
}

public 
client_authorized(id)
{
    
g_iVIPLevel[id] = -1;
    
check_user(id);
}

public 
check_user(id)
{
    new 
szName[33]
    
get_user_name(idszName32);

    new 
itsszData[15];

    if(
nvault_lookup(g_nVaultszNameszDatacharsmax(szData), its))
    {
        new 
szLevel[15];
        new 
szTime[15];

        
parse(szDataszTimecharsmax(szTime), szLevelcharsmax(szLevel));

        if(
str_to_num(szTime) <= get_systime())
        {
            
g_iVIPLevel[id] = -1;
            
set_task(VIP_EXPIRED_MSG_FLOAT"msgexpired"id 12345);
            return 
PLUGIN_CONTINUE;
        } else 
g_iVIPLevel[id] = str_to_num(szLevel);

        switch(
g_iVIPLevel[id])
        {
            case 
0set_user_flags(idread_flags(ONE_HOUR_FLAG));
            case 
1set_user_flags(idread_flags(TWO_HOUR_FLAG));
        }
    }

    return 
PLUGIN_CONTINUE;
}

public 
msgexpired(id)
{
    
id -= 12345;
    
client_print_color(idprint_team_default"%s Your VIP^4 expired^1!"TAG);
}

// CT's menu
public menu_ct(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Points: \g %d"point); 
    new 
menu menu_create(Temp"handler_ct"

    new 
szItemName[64
    for(new 
ii<sizeof szCTItems && i<sizeof g_szCostCTi++) 
    {
        if( 
point g_szCostCT[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szCTItems], g_szCostCT])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s\y(%d)"szCTItems], g_szCostCT])
        }
        
menu_additem(menu szItemName)
    }
    
menu_additem(menu"/wBUY VIP FOR 1 HOUR /r400Pts""vip_1");
    
menu_additem(menu"/wBUY VIP FOR 2 HOUR /r650Pts""vip_2");

    
menu_display(id menu 0)
}

// TR's menu
public menu_t(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Point:\y %d"point)
    new 
menu menu_create(Temp"handler_t"


    new 
szItemName[64]
    for(new 
ii<sizeof szTRItems && i<sizeof g_szCostTRi++)
    {
        if( 
point g_szCostTR[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szTRItems], g_szCostTR])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s \y(%d)"szTRItems], g_szCostTR])
        }
        
menu_additem(menu szItemName)
    }

    
menu_additem(menu"/wBUY VIP FOR 1 HOUR /r400Pts""vip_1");
    
menu_additem(menu"/wBUY VIP FOR 2 HOUR /r650Pts""vip_2");

    
menu_display(id menu 0)
}

// CT menu handler
public handler_ct(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostCT[item]   

    if( 
point g_szCostCT[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    


    new 
szData[10];
    
menu_item_getinfo(menuitem_szDatacharsmax(szData), ___);

    if(
equali(szData"vip_1"))
    {
        
give_vip(id0);
        return 
PLUGIN_HANDLED;
    }
    
    if(
equali(szData"vip_2"))
    {
        
give_vip(id1);
        return 
PLUGIN_HANDLED;
    }

    switch(
item
    {
        case 
0:
        {
            
give_item(id "weapon_m249")
            
cs_set_user_bpammo(id CSW_M249 200)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
        case 
5:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 
}

give_vip(idvip_type)
{
    switch(
g_iVIPLevel[id])
    {
        case -
1:
        {
            new 
iTime;
            switch(
vip_type)
            {
                case 
0iTime get_systime(3600);
                case 
1iTime get_systime(7200);
            }

            new 
szKey[MAX_AUTHID_LENGTH];
            
get_user_authid(idszKeycharsmax(szKey));
            new 
szData[64];
            
g_iVIPLevel[id] = vip_type;
            
formatex(szDatacharsmax(szData), "%i %i"vip_typeiTime);
            
set_user_flags(idvip_type == read_flags(ONE_HOUR_FLAG) : read_flags(TWO_HOUR_FLAG));
            
nvault_set(g_nVaultszKeyszData);
        }

        case 
0..1
        {
            
client_print_color(idprint_team_default"%s You already have^3 %i Hour%s VIP^1."TAG,
            
g_iVIPLevel[id] == "1" "2"g_iVIPLevel[id] > "s" "");
        }
    }
}

// TR menu hadnler
public handler_t(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostTR[item]   

    if( 
point g_szCostTR[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    


    new 
szData[10];
    
menu_item_getinfo(menuitem_szDatacharsmax(szData), ___);

    if(
equali(szData"vip_1"))
    {
        
give_vip(id0);
        return 
PLUGIN_HANDLED;
    }
    
    if(
equali(szData"vip_2"))
    {
        
give_vip(id1);
        return 
PLUGIN_HANDLED;
    }

    switch(
item
    {
        case 
0:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 


// Show them a message when they don't have enough money
NotEnoughMoneyid 

    
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money")

    
message_begin(MSG_ONE_UNRELIABLEg_iBlinkAcct, .player=id)
    { 
        
write_byte(2)
    } 
    
message_end() 

try this one, not tested
Alright Dude
__________________
Thanks you
SHIFT0 is offline
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Algeria
Old 07-04-2022 , 10:43   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #7

Quote:
Originally Posted by lexzor View Post
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <point_system>
#include <nvault>

#define TAG "^4[TAG]^1"
#define VIP_EXPIRED_MSG_FLOAT 10.0
#define ONE_HOUR_FLAG "t"
#define TWO_HOUR_FLAG "n"

new g_iBlinkAcct
new g_iVIPLevel[MAX_PLAYERS 1];

new const 
VERSION[] = "1.0"

new g_nVault;

// CT items
new szCTItems[][]=
{
    
"M249 Gun",
    
"10000$ Money",
    
"5000$ Money",
    
"50 HP",
    
"50 AP",
    
"He-Grenade"

}

// TR Items
new szTRItems[][]=
{
    
"10000$ Money",
    
"5000$ Money",
    
"He-Grenade",
    
"50 HP",
    
"50 AP" 
}

// CT items price (point)
new g_szCostCT[] =
{
    
50,
    
40,
    
20,
    
15,
    
5,
    
10
}
// TR Items price (point)
new g_szCostTR[] =
{
    
40,
    
20,
    
10,
    
15,
    
5
}

public 
plugin_init()
{
    
register_plugin("Point Shop"VERSION"LearninG")
    
// register a way to open menu
    
register_clcmd("say /sp""shop")
    
register_clcmd("say_team /sp" "shop")
    
register_clcmd("say /shop""shop")
    
register_clcmd("say_team /shop""shop")

    
g_nVault nvault_open("temp_vip");

    if(
g_nVault == INVALID_HANDLE)
        
set_fail_state("error  in opening vip nvualt")
}

public 
plugin_end()
{
    
nvault_close(g_nVault);
}

// show them a menu based on their team
public shop(id
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_CT:
        {
            
menu_ct(id)
        }
        case 
CS_TEAM_T:
        {
            
menu_t(id)
        }
    }
}

public 
client_authorized(id)
{
    
g_iVIPLevel[id] = -1;
    
check_user(id);
}

public 
check_user(id)
{
    new 
szName[33]
    
get_user_name(idszName32);

    new 
itsszData[15];

    if(
nvault_lookup(g_nVaultszNameszDatacharsmax(szData), its))
    {
        new 
szLevel[15];
        new 
szTime[15];

        
parse(szDataszTimecharsmax(szTime), szLevelcharsmax(szLevel));

        if(
str_to_num(szTime) <= get_systime())
        {
            
g_iVIPLevel[id] = -1;
            
set_task(VIP_EXPIRED_MSG_FLOAT"msgexpired"id 12345);
            return 
PLUGIN_CONTINUE;
        } else 
g_iVIPLevel[id] = str_to_num(szLevel);

        switch(
g_iVIPLevel[id])
        {
            case 
0set_user_flags(idread_flags(ONE_HOUR_FLAG));
            case 
1set_user_flags(idread_flags(TWO_HOUR_FLAG));
        }
    }

    return 
PLUGIN_CONTINUE;
}

public 
msgexpired(id)
{
    
id -= 12345;
    
client_print_color(idprint_team_default"%s Your VIP^4 expired^1!"TAG);
}

// CT's menu
public menu_ct(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Points: \g %d"point); 
    new 
menu menu_create(Temp"handler_ct"

    new 
szItemName[64
    for(new 
ii<sizeof szCTItems && i<sizeof g_szCostCTi++) 
    {
        if( 
point g_szCostCT[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szCTItems], g_szCostCT])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s\y(%d)"szCTItems], g_szCostCT])
        }
        
menu_additem(menu szItemName)
    }
    
menu_additem(menu"/wBUY VIP FOR 1 HOUR /r400Pts""vip_1");
    
menu_additem(menu"/wBUY VIP FOR 2 HOUR /r650Pts""vip_2");

    
menu_display(id menu 0)
}

// TR's menu
public menu_t(id)
{
    new 
Temp[101], point
    point 
get_user_point(id)
     
    
formatex(Temp,charsmax(Temp), "\rYour Point:\y %d"point)
    new 
menu menu_create(Temp"handler_t"


    new 
szItemName[64]
    for(new 
ii<sizeof szTRItems && i<sizeof g_szCostTRi++)
    {
        if( 
point g_szCostTR[i] )
        {
            
formatex(szItemNamecharsmax(szItemName), "\d%s (%d)"szTRItems], g_szCostTR])
        }
        else
        {
            
formatex(szItemNamecharsmax(szItemName), "%s \y(%d)"szTRItems], g_szCostTR])
        }
        
menu_additem(menu szItemName)
    }

    
menu_additem(menu"/wBUY VIP FOR 1 HOUR /r400Pts""vip_1");
    
menu_additem(menu"/wBUY VIP FOR 2 HOUR /r650Pts""vip_2");

    
menu_display(id menu 0)
}

// CT menu handler
public handler_ct(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostCT[item]   

    if( 
point g_szCostCT[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    


    new 
szData[10];
    
menu_item_getinfo(menuitem_szDatacharsmax(szData), ___);

    if(
equali(szData"vip_1"))
    {
        
give_vip(id0);
        return 
PLUGIN_HANDLED;
    }
    
    if(
equali(szData"vip_2"))
    {
        
give_vip(id1);
        return 
PLUGIN_HANDLED;
    }

    switch(
item
    {
        case 
0:
        {
            
give_item(id "weapon_m249")
            
cs_set_user_bpammo(id CSW_M249 200)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
        case 
5:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 
}

give_vip(idvip_type)
{
    switch(
g_iVIPLevel[id])
    {
        case -
1:
        {
            new 
iTime;
            switch(
vip_type)
            {
                case 
0iTime get_systime(3600);
                case 
1iTime get_systime(7200);
            }

            new 
szKey[MAX_AUTHID_LENGTH];
            
get_user_authid(idszKeycharsmax(szKey));
            new 
szData[64];
            
g_iVIPLevel[id] = vip_type;
            
formatex(szDatacharsmax(szData), "%i %i"vip_typeiTime);
            
set_user_flags(idvip_type == read_flags(ONE_HOUR_FLAG) : read_flags(TWO_HOUR_FLAG));
            
nvault_set(g_nVaultszKeyszData);
        }

        case 
0..1
        {
            
client_print_color(idprint_team_default"%s You already have^3 %i Hour%s VIP^1."TAG,
            
g_iVIPLevel[id] == "1" "2"g_iVIPLevel[id] > "s" "");
        }
    }
}

// TR menu hadnler
public handler_t(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED 
    
}
    new 
point get_user_point(id);
    new 
new_point get_user_point(id) - g_szCostTR[item]   

    if( 
point g_szCostTR[item] ) 
    {
        
NotEnoughMoneyid )
        
menu_display(idmenu)
        return 
PLUGIN_HANDLED
    


    new 
szData[10];
    
menu_item_getinfo(menuitem_szDatacharsmax(szData), ___);

    if(
equali(szData"vip_1"))
    {
        
give_vip(id0);
        return 
PLUGIN_HANDLED;
    }
    
    if(
equali(szData"vip_2"))
    {
        
give_vip(id1);
        return 
PLUGIN_HANDLED;
    }

    switch(
item
    {
        case 
0:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 10000)
            
set_user_point(id new_point)
        }
        case 
1:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 5000)
            
set_user_point(id new_point)

        }
        case 
2:
        {
            
give_item(id "weapon_hegrenade")
            
set_user_point(id new_point)
        }
        case 
3:
        {
            
set_user_health(id get_user_health(id) + 50)
            
set_user_point(id new_point)

        }
        case 
4:
        {
            
set_user_armor(id get_user_armor(id) + 50)
            
set_user_point(id new_point)

        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED 


// Show them a message when they don't have enough money
NotEnoughMoneyid 

    
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money")

    
message_begin(MSG_ONE_UNRELIABLEg_iBlinkAcct, .player=id)
    { 
        
write_byte(2)
    } 
    
message_end() 

try this one, not tested

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "MAX_PLAYERS" on line 13
Error: Invalid array size (negative or zero) on line 13
Error: Undefined symbol "client_print_color" on line 137
Warning: Expression has no effect on line 137
Warning: Expression has no effect on line 137
Error: Expected token: ";", but found ")" on line 137
Error: Invalid expression, assumed zero on line 137
Error: Too many error messages on one line on line 137

Compilation aborted.
6 Errors.
Could not locate output file D:\AMX Mod X\amxxstudio\Untitled.amx (compile failed).
__________________
Thanks you
SHIFT0 is offline
TribalBlood
Member
Join Date: Oct 2020
Location: Defqon.1
Old 07-04-2022 , 11:20   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #8

update to 1.8.3 or 1.9 that compiler is old.
__________________
TribalBlood is online now
lexzor
Senior Member
Join Date: Nov 2020
Old 07-04-2022 , 16:23   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #9

you can download the compiler from this link (https://www.amxmodx.org/downloads-new.php), it is in "scripting" folder
lexzor is online now
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Algeria
Old 07-04-2022 , 19:48   Re: BUY VIP 1H/2H by Your Points [ HELP Pls ]
Reply With Quote #10

Alright guys
__________________
Thanks you
SHIFT0 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 06:46.


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