Cerere modficare shop

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

24 Dec 2020, 09:27

Hello this is a furien shop plugin with 1 item for vip in furien and 1 item for vip in anti furien
but problem is this when i purchase super vip knife it come perfectly but when i switch my knife and take grenade or any other item my vip model change back to normal knife please help to fix

this is the code
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta_util>
#include < hamsandwich >

#define PLUGIN_NAME    "Furien Shop"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR  "xyz"

#define FURIEN_VIP ADMIN_LEVEL_H
#define TEAM_ANTIFURIEN 2
#define TEAM_FURIEN 1
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )
new g_iMaxPlayers;
new has_no_flash[33]
new has_model[33]

new const models[][] =  { "models/v_superknife.mdl", "models/v_superknifeVIP.mdl" }

new g_msgScreenFade
new const prefix[] = { "!g[!tshop!g]!n" }

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    
    register_clcmd("say /shop", "shop")
    register_clcmd("say_team /shop", "shop")
    register_clcmd("say shop", "shop")
    register_clcmd("say_team vshop", "shop")
    RegisterHam( Ham_Item_Deploy, "weapon_knife", "Ham_KnifeDeployPost", 1 );
    register_event("DeathMsg", "deathmsg", "a");
    register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199")
    RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
    g_iMaxPlayers = get_maxplayers ( );
    g_msgScreenFade = get_user_msgid("ScreenFade")
}

public deathmsg(){
    new ivictim = read_data(2);
    has_no_flash[ivictim] = false;
    has_model[ivictim]=false;
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
    if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && has_model[ iAttacker ] ) 
    {
        if(get_user_flags(iAttacker) & FURIEN_VIP)
            SetHamParamFloat ( 4, fDamage * 4.0 );
        else
            SetHamParamFloat ( 4, fDamage * 2.0 );       
        return HAM_HANDLED;
    }
    
    return HAM_IGNORED;
    
}

public Ham_KnifeDeployPost( iEnt ) 
{
    new id = get_pdata_cbase( iEnt, 41 );
    if(has_model[id])
    entity_set_string( id, EV_SZ_viewmodel, get_user_flags(id) & FURIEN_VIP ? models[1] : models[0]);
}

public client_disconnect(id){
    
    has_no_flash[id] = false;
    has_model[id]=false;
    
}

public client_connect(id){
    
    has_no_flash[id] = false;
    has_model[id]=false;
    
}

public plugin_precache() {
    precache_model(models[0])
    precache_model(models[1])
    
}

public eventFlash(id)
{
    if(has_no_flash[id])
    {
        message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
        write_short(1)
        write_short(1)
        write_short(1)
        write_byte(0)
        write_byte(0)
        write_byte(0)
        write_byte(255)
        message_end()
    }
}


public shop(id)
{
    if(!is_user_alive(id))
    {
        client_printc(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    switch(cs_get_user_team(id))
    {
        case TEAM_ANTIFURIEN:
            AFURIEN(id);
        
        case TEAM_FURIEN:
            FURIEN(id);
    }
    return PLUGIN_HANDLED;
}


public FURIEN(id)
{
    if(!is_user_alive(id))
    {
        client_printc(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    new menu = menu_create("\furien shop", "shop_furien");
    
    menu_additem(menu, "\wSUPER KNIFE \y====> \y[\rDAMAGE x2\y]\R1000$", "1", 0);
    menu_additem(menu, "\wHE GRENADE \y====> \y[\rBOMB\y]\R4000$", "2", 0);
    menu_additem(menu, "\w50 HP \y====> \y[\rHEALTH\y]\R3000$", "3", 0);
    menu_additem(menu, "\w50 AP \y====> \y[\rARMOR\y]\R500$", "4", 0);
    menu_additem(menu, "\wSUPER KNIFE \rVIP \y====> \y[\rDAMAGE x4\y]\RFREE ", "5", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
    
    return PLUGIN_HANDLED
}

public shop_furien(id, menu, item)
{
    if(!is_user_alive(id))
    {
        client_printc(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    new tmp_money = cs_get_user_money(id)
    
    switch(key)
    {
        case 1:
        {
            if(tmp_money < 10000)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            if(has_model[id])
            {
                client_printc(id, "%s Ai deja !gSuperKnife!n!", prefix);
                return PLUGIN_HANDLED;
            }
            has_model[id]=true;
            if(get_user_weapon( id ) == CSW_KNIFE)
                set_pev(id, pev_viewmodel2, models[0])
            cs_set_user_money(id, tmp_money - 10000)
            client_printc(id, "%s Ai cumparat !gSuper!tKnife!n!", prefix);
        }
        case 2:
        {
            if(tmp_money < 3000)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            if(user_has_weapon(id, CSW_HEGRENADE))
            {
                client_printc(id, "%s Ai deja !gHe!tGrenade!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            give_item(id, "weapon_hegrenade")
            cs_set_user_money(id, tmp_money - 3000)
            client_printc(id, "%s Ai cumparat !gHe!tGrenade!n!", prefix);
            
        }
        case 3:
        {
            if(tmp_money < 3000)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new health = get_user_health(id);
            
            if(health >= 200){
                client_printc(id, "%s Nu poti cumpara mai mult de !g200!t HP", prefix);
                return PLUGIN_HANDLED;
            }
            health+=50;
            
            set_user_health(id, clamp(health,0,200) == 200 ? 200 : health)
            
            cs_set_user_money(id, tmp_money - 3000)
            client_printc(id, "%s Ai cumparat !g+50!tHP!n!", prefix);
        }
        case 4:
        {
            
            if(tmp_money < 500)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new armor = get_user_armor(id);
            
            if(armor >= 300){
                client_printc(id, "%s Nu poti cumpara mai mult de !g300!t AP", prefix);
                return PLUGIN_HANDLED;
            }
            armor+=50
            
            set_user_armor(id, clamp(armor,0,300) == 300 ? 300 : armor)
            
            cs_set_user_money(id, tmp_money - 500)
            client_printc(id, "%s Ai cumparat !g+50!tAP!n!", prefix);
        }
        case 5:
        {
            if(get_user_flags(id) & FURIEN_VIP)
            {
                if(has_model[id])
                {
                client_printc(id, "%s Ai deja !gSuperKnife!n!", prefix);
                return PLUGIN_HANDLED;
                }
                client_printc(id, "%s Ai ales !gSuper!tKnife!gV!nI!gP!n!", prefix);
                has_model[id]=true;
                if(get_user_weapon( id ) == CSW_KNIFE)
                    set_pev(id, pev_viewmodel2, models[1])
            }    
        }
        
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public AFURIEN(id)
{
    if(!is_user_alive(id))
    {
        client_printc(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    new menu = menu_create("\wANTI-FURIEN SHOP", "shop_afurien");
    
    menu_additem(menu, "\wDEFUSE KIT \y====> \y[\rC4 DEFUSE\y]\R500$ ", "1", 0);
    menu_additem(menu, "\wHE GRENADE \y====> \y[\rBOMB\y]\R4000$", "2", 0);
    menu_additem(menu, "\w50 HP \y====> \y[\rHEALTH\y]\R3000$", "3", 0);
    menu_additem(menu, "\w50 AP \y====> \y[\rARMOR\y]\R500$", "4", 0);
    menu_additem(menu, "\wNO FLASH \y====> \y[\rVIP\y]\RFREE", "5", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
    
    return PLUGIN_HANDLED
}

public shop_afurien(id, menu, item)
{
    if(!is_user_alive(id))
    {
        client_printc(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    new tmp_money = cs_get_user_money(id)
    
    switch(key)
    {
        case 1:
        {
            if(tmp_money < 500)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            if(cs_get_user_defuse(id))
            {
                client_printc(id, "%s Ai deja !gDefuse!tKIT!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            cs_set_user_money(id, tmp_money - 500)
            give_item(id, "item_thighpack");
            give_item(id, "item_assaultsuit");
            client_printc(id, "%s Ai cumparat !gDefuse!tKIT!n!", prefix);
        }
        case 2:
        {
            if(tmp_money < 3000)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            if(user_has_weapon(id, CSW_HEGRENADE))
            {
                client_printc(id, "%s Ai deja !gHe!tGrenade!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            give_item(id, "weapon_hegrenade")
            cs_set_user_money(id, tmp_money - 3000)
            client_printc(id, "%s Ai cumparat !gHe!tGrenade!n!", prefix);
            
        }
        case 3:
        {
            if(tmp_money < 3000)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new health = get_user_health(id);
            
            if(health >= 200){
                client_printc(id, "%s Nu poti cumpara mai mult de !g200!t HP", prefix);
                return PLUGIN_HANDLED;
            }
            health+=50;
            
            set_user_health(id, clamp(health,0,200) == 200 ? 200 : health)
            cs_set_user_money(id, tmp_money - 3000)
            client_printc(id, "%s Ai cumparat !g+50!tHP!n!", prefix);
        }
        case 4:
        {
            
            if(tmp_money < 500)
            {
                client_printc(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new armor = get_user_armor(id);
            
            if(armor >= 300){
                client_printc(id, "%s Nu poti cumpara mai mult de !g300!t AP", prefix);
                return PLUGIN_HANDLED;
            }
            armor+=50
            
            set_user_armor(id, clamp(armor,0,300) == 300 ? 300 : armor);
            
            cs_set_user_money(id, tmp_money - 500)
            client_printc(id, "%s Ai cumparat !g+50!tAP!n!", prefix);
        }
        case 5:
        {  
            if(get_user_flags(id) & FURIEN_VIP)
            {
            has_no_flash[id]=true;
            client_printc(id, "%s Ai cumparat !gNo!tFlash!n!", prefix);
            }

        }    
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

stock client_printc(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!g", "^x04"); // Green Color
    replace_all(msg, 190, "!n", "^x01"); // Default Color
    replace_all(msg, 190, "!t", "^x03"); // Team Color
    
    if(id)
        players[0] = id;
    else
        get_players(players, count, "ch");
    
    for (new i = 0; i < count; i++)
    {
        message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
        write_byte(players);
        write_string(msg);
        message_end();
    }
} 
User avatar
ciprian3213
Membru, skill +1
Membru, skill +1
Posts: 191
Joined: 23 Mar 2015, 17:17
Detinator Steam: Da
CS Status: Nothing here !
Fond eXtream: 0
Location: Dorohoi, Botosani
Contact:

22 Jan 2021, 17:04

I dont know if you need this anymore, but you can try this.
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta_util>
#include < hamsandwich >

#define PLUGIN_NAME    "Furien Shop"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR  "xyz"

#define FURIEN_VIP ADMIN_LEVEL_H
#define TEAM_ANTIFURIEN 2
#define TEAM_FURIEN 1
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )
new g_iMaxPlayers;
new has_no_flash[33]
new has_model[33]

new const models[][] =  { "models/v_superknife.mdl", "models/v_superknifeVIP.mdl" }

new g_msgScreenFade
new const prefix[] = { "!g[!tshop!g]!n" }

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    
    register_clcmd("say /shop", "shop")
    register_clcmd("say_team /shop", "shop")
    register_clcmd("say shop", "shop")
    register_clcmd("say_team vshop", "shop")
    RegisterHam( Ham_Item_Deploy, "weapon_knife", "Ham_KnifeDeployPost", 1 );
    register_event("DeathMsg", "deathmsg", "a");
    register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199");
    RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
    g_iMaxPlayers = get_maxplayers ( );
    g_msgScreenFade = get_user_msgid("ScreenFade");
    register_event("CurWeapon", "CurrentWeapons", "be", "1=1")
}

public deathmsg(){
    new ivictim = read_data(2);
    has_no_flash[ivictim] = false;
    has_model[ivictim]=false;
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
    if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && has_model[ iAttacker ] ) 
    {
        if(get_user_flags(iAttacker) & FURIEN_VIP)
            SetHamParamFloat ( 4, fDamage * 4.0 );
        else
            SetHamParamFloat ( 4, fDamage * 2.0 );       
        return HAM_HANDLED;
    }
    
    return HAM_IGNORED;
    
}

public CurrentWeapons(id)
{
	if(is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE && has_model[id] && get_user_team(id) == 1)
	{
		set_pev(id, pev_viewmodel2, models[1]);
	}
	
}

public Ham_KnifeDeployPost( iEnt ) 
{
    new id = get_pdata_cbase( iEnt, 41 );
    if(has_model[id])
    entity_set_string( id, EV_SZ_viewmodel, get_user_flags(id) & FURIEN_VIP ? models[1] : models[0]);
}

public client_disconnect(id){
    
    has_no_flash[id] = false;
    has_model[id]=false;
    
}

public client_connect(id){
    
    has_no_flash[id] = false;
    has_model[id]=false;
    
}

public plugin_precache() {
    precache_model(models[0])
    precache_model(models[1])
    
}

public eventFlash(id)
{
    if(has_no_flash[id])
    {
        message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
        write_short(1)
        write_short(1)
        write_short(1)
        write_byte(0)
        write_byte(0)
        write_byte(0)
        write_byte(255)
        message_end()
    }
}


public shop(id)
{
    if(!is_user_alive(id))
    {
        ChatColor(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    switch(cs_get_user_team(id))
    {
        case TEAM_ANTIFURIEN:
            AFURIEN(id);
        
        case TEAM_FURIEN:
            FURIEN(id);
    }
    return PLUGIN_HANDLED;
}


public FURIEN(id)
{
    if(!is_user_alive(id))
    {
        ChatColor(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    new menu = menu_create("\furien shop", "shop_furien");
    
    menu_additem(menu, "\wSUPER KNIFE \y====> \y[\rDAMAGE x2\y]\R1000$", "1", 0);
    menu_additem(menu, "\wHE GRENADE \y====> \y[\rBOMB\y]\R4000$", "2", 0);
    menu_additem(menu, "\w50 HP \y====> \y[\rHEALTH\y]\R3000$", "3", 0);
    menu_additem(menu, "\w50 AP \y====> \y[\rARMOR\y]\R500$", "4", 0);
    menu_additem(menu, "\wSUPER KNIFE \rVIP \y====> \y[\rDAMAGE x4\y]\RFREE ", "5", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
    
    return PLUGIN_HANDLED
}

public shop_furien(id, menu, item)
{
    if(!is_user_alive(id))
    {
        ChatColor(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    new tmp_money = cs_get_user_money(id)
    
    switch(key)
    {
        case 1:
        {
            if(tmp_money < 10000)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            if(has_model[id])
            {
                ChatColor(id, "%s Ai deja !gSuperKnife!n!", prefix);
                return PLUGIN_HANDLED;
            }
            has_model[id]=true;
            if(get_user_weapon( id ) == CSW_KNIFE)
                set_pev(id, pev_viewmodel2, models[0])
            cs_set_user_money(id, tmp_money - 10000)
            ChatColor(id, "%s Ai cumparat !gSuper!tKnife!n!", prefix);
        }
        case 2:
        {
            if(tmp_money < 3000)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            if(user_has_weapon(id, CSW_HEGRENADE))
            {
                ChatColor(id, "%s Ai deja !gHe!tGrenade!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            give_item(id, "weapon_hegrenade")
            cs_set_user_money(id, tmp_money - 3000)
            ChatColor(id, "%s Ai cumparat !gHe!tGrenade!n!", prefix);
            
        }
        case 3:
        {
            if(tmp_money < 3000)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new health = get_user_health(id);
            
            if(health >= 200){
                ChatColor(id, "%s Nu poti cumpara mai mult de !g200!t HP", prefix);
                return PLUGIN_HANDLED;
            }
            health+=50;
            
            set_user_health(id, clamp(health,0,200) == 200 ? 200 : health)
            
            cs_set_user_money(id, tmp_money - 3000)
            ChatColor(id, "%s Ai cumparat !g+50!tHP!n!", prefix);
        }
        case 4:
        {
            
            if(tmp_money < 500)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new armor = get_user_armor(id);
            
            if(armor >= 300){
                ChatColor(id, "%s Nu poti cumpara mai mult de !g300!t AP", prefix);
                return PLUGIN_HANDLED;
            }
            armor+=50
            
            set_user_armor(id, clamp(armor,0,300) == 300 ? 300 : armor)
            
            cs_set_user_money(id, tmp_money - 500)
            ChatColor(id, "%s Ai cumparat !g+50!tAP!n!", prefix);
        }
        case 5:
        {
            if(get_user_flags(id) & FURIEN_VIP)
            {
                if(has_model[id])
                {
                ChatColor(id, "%s Ai deja !gSuperKnife!n!", prefix);
                return PLUGIN_HANDLED;
                }
                ChatColor(id, "%s Ai ales !gSuper!tKnife!gV!nI!gP!n!", prefix);
                has_model[id]=true;
                CurrentWeapons(id);
            }    
        }
        
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public AFURIEN(id)
{
    if(!is_user_alive(id))
    {
        ChatColor(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    new menu = menu_create("\wANTI-FURIEN SHOP", "shop_afurien");
    
    menu_additem(menu, "\wDEFUSE KIT \y====> \y[\rC4 DEFUSE\y]\R500$ ", "1", 0);
    menu_additem(menu, "\wHE GRENADE \y====> \y[\rBOMB\y]\R4000$", "2", 0);
    menu_additem(menu, "\w50 HP \y====> \y[\rHEALTH\y]\R3000$", "3", 0);
    menu_additem(menu, "\w50 AP \y====> \y[\rARMOR\y]\R500$", "4", 0);
    menu_additem(menu, "\wNO FLASH \y====> \y[\rVIP\y]\RFREE", "5", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
    
    return PLUGIN_HANDLED
}

public shop_afurien(id, menu, item)
{
    if(!is_user_alive(id))
    {
        ChatColor(id, "%s Trebuie sa fi in viata ca sa folosesti !gShop-ul!n!", prefix);
        return PLUGIN_HANDLED
    }
    
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    new tmp_money = cs_get_user_money(id)
    
    switch(key)
    {
        case 1:
        {
            if(tmp_money < 500)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            if(cs_get_user_defuse(id))
            {
                ChatColor(id, "%s Ai deja !gDefuse!tKIT!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            cs_set_user_money(id, tmp_money - 500)
            give_item(id, "item_thighpack");
            give_item(id, "item_assaultsuit");
            ChatColor(id, "%s Ai cumparat !gDefuse!tKIT!n!", prefix);
        }
        case 2:
        {
            if(tmp_money < 3000)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            if(user_has_weapon(id, CSW_HEGRENADE))
            {
                ChatColor(id, "%s Ai deja !gHe!tGrenade!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            give_item(id, "weapon_hegrenade")
            cs_set_user_money(id, tmp_money - 3000)
            ChatColor(id, "%s Ai cumparat !gHe!tGrenade!n!", prefix);
            
        }
        case 3:
        {
            if(tmp_money < 3000)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new health = get_user_health(id);
            
            if(health >= 200){
                ChatColor(id, "%s Nu poti cumpara mai mult de !g200!t HP", prefix);
                return PLUGIN_HANDLED;
            }
            health+=50;
            
            set_user_health(id, clamp(health,0,200) == 200 ? 200 : health)
            cs_set_user_money(id, tmp_money - 3000)
            ChatColor(id, "%s Ai cumparat !g+50!tHP!n!", prefix);
        }
        case 4:
        {
            
            if(tmp_money < 500)
            {
                ChatColor(id, "%s Nu ai suficienti !gbani!n!", prefix);
                return PLUGIN_HANDLED;
            }
            
            new armor = get_user_armor(id);
            
            if(armor >= 300){
                ChatColor(id, "%s Nu poti cumpara mai mult de !g300!t AP", prefix);
                return PLUGIN_HANDLED;
            }
            armor+=50
            
            set_user_armor(id, clamp(armor,0,300) == 300 ? 300 : armor);
            
            cs_set_user_money(id, tmp_money - 500)
            ChatColor(id, "%s Ai cumparat !g+50!tAP!n!", prefix);
        }
        case 5:
        {  
            if(get_user_flags(id) & FURIEN_VIP)
            {
            has_no_flash[id]=true;
            ChatColor(id, "%s Ai cumparat !gNo!tFlash!n!", prefix);
            }

        }    
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

stock ChatColor(const id, const input[], any:...)
{
        new count = 1, players[32];
        static msg[191];
        vformat(msg, 190, input, 3);
       
        replace_all(msg, 190, "!g", "^4"); // Green Color
        replace_all(msg, 190, "!n", "^1"); // Default Color
        replace_all(msg, 190, "!t", "^3"); // Team Color
        replace_all(msg, 190, "!t2", "^0"); // Team2 Color

        if (id) players[0] = id; else get_players(players, count, "ch"); {
                for (new i = 0; i < count; i++) {
                        if (is_user_connected(players)) {
                                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
                                write_byte(players);
                                write_string(msg);
                                message_end();
                        }
                }
        }
}
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests