AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Help Me Furien Menu (https://forums.alliedmods.net/showthread.php?t=325880)

Al3xandru27 07-09-2020 20:29

Help Me Furien Menu
 
When I buy super knife or super knife vip from the shop if I take the grenade in my hand or anything else the item disappears

sma:

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <engine> 
#include <fakemeta_util> 

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

#define FURIEN_VIP ADMIN_LEVEL_H

new has_no_flash[33]
new 
has_model[33]

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

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

public 
plugin_init() 

    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR
    
    
register_clcmd("say /shop""shop"
    
register_clcmd("say_team /shop""shop"
    
register_event("CurWeapon","switchweapon","be","1=1","2!29")
    
register_event("DeathMsg""deathmsg""a"); 
    
register_event("ScreenFade""eventFlash""be""4=255""5=255""6=255""7>199"
    
    
g_msgScreenFade get_user_msgid("ScreenFade"


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

public 
switchweapon(id)
{
    if(
is_user_alive(id) && has_model[id])
           if(
get_user_weaponid ) == CSW_KNIFE)
              
set_pev(idpev_viewmodel2get_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_ONEg_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 You !gmust !nbe !talive !nto !topen !nthe !gShop!n!"prefix); 
        return 
PLUGIN_HANDLED 
    

    
    switch(
cs_get_user_team(id)) 
    { 
        case 
CS_TEAM_CT
            
AFURIEN(id); 
        
        case 
CS_TEAM_T
            
FURIEN(id); 
    } 
    return 
PLUGIN_HANDLED



public 
FURIEN(id

    if(!
is_user_alive(id)) 
    { 
        
client_printc(id"%s You !gmust !nbe !talive !nto !topen !nthe !gShop!n!"prefix); 
        return 
PLUGIN_HANDLED 
    

    
    new 
menu menu_create("FURIEN Shop""shop_furien"); 
    
    
menu_additem(menu"Super Knife [10000$] ""1"0); 
    
menu_additem(menu"HE Grenade  [3000$] ""2"0); 
    
menu_additem(menu"+50 Health  [3000$] ""3"0); 
    
menu_additem(menu"+50 Armor   [500$] ""4"0); 
    
menu_additem(menu"No Flash    [1000$] ""5"0); 
    
menu_additem(menu"Super Knife VIP ""6"0); 
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL); 
    
menu_display(idmenu0); 
    
    return 
PLUGIN_HANDLED 


public 
shop_furien(idmenuitem

    if(!
is_user_alive(id)) 
    { 
        
client_printc(id"%s You !gmust !nbe !talive !nto !topen !nthe !gShop!n!"prefix); 
        return 
PLUGIN_HANDLED 
    

    
    if(
item == MENU_EXIT
    { 
        
menu_destroy(menu); 
        return 
PLUGIN_HANDLED
    } 
    
    new 
data[6], iName[64]; 
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback); 
    
    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 You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
has_model[id]=true;
            if(
get_user_weaponid ) == CSW_KNIFE)
            
set_pev(idpev_viewmodel2models[0]) 
            
cs_set_user_money(idtmp_money 10000
            
client_printc(id"%s You bought !gSuper Knife!"prefix); 
        } 
        case 
2
        { 
            if(
tmp_money 3000)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            if(
user_has_weapon(idCSW_HEGRENADE))
            {
              
client_printc(id"%s You already have !gHeGrenade!"prefix); 
              return 
PLUGIN_HANDLED;
            }
            
            
give_item(id"weapon_hegrenade"
            
cs_set_user_money(idtmp_money 3000
            
client_printc(id"%s You bought !gHE Grenade!"prefix); 
            
        } 
        case 
3
        { 
            if(
tmp_money 3000)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            new 
health get_user_health(id);
            
            if(
health >= 200){
                
client_printc(id"%s You cant have more than !g200 Health!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
health+=50;
            
            
set_user_health(idclamp(health,0,200) == 200 200 health
            
            
cs_set_user_money(idtmp_money 3000
            
client_printc(id"%s You bought !g+50 HP!"prefix); 
        } 
        case 
4
        { 
            
            if(
tmp_money 500)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            new 
armor get_user_armor(id);
            
            if(
armor >= 300){
                
client_printc(id"%s You cant have more than !g300 Armor!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
armor+=50
            
            set_user_armor
(idclamp(armor,0,300) == 300 300 armor
            
            
cs_set_user_money(idtmp_money 500
            
client_printc(id"%s You bought !g+50 AP!"prefix); 
        } 
        case 
5
        { 
            if(
tmp_money 1000)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            
has_no_flash[id]=true;
            
cs_set_user_money(idtmp_money 1000
            
client_printc(id"%s You bought !gNo Flash!"prefix); 
        } 
        case 
6
        { 
            if(
get_user_flags(id) & FURIEN_VIP
            { 
                
client_printc(id"%s You taked !gSuper Knife VIP!"prefix); 
                
has_model[id]=true;
                if(
get_user_weaponid ) == CSW_KNIFE)
                
set_pev(idpev_viewmodel2models[1]) 
            }     
        } 
        
    } 
    
    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED


public 
AFURIEN(id

    if(!
is_user_alive(id)) 
    { 
        
client_printc(id"%s You !gmust !nbe !talive !nto !topen !nthe !gShop!n!"prefix); 
        return 
PLUGIN_HANDLED 
    

    
    new 
menu menu_create("Anti-Furien Shop""shop_afurien"); 
    
    
menu_additem(menu"Defuse Kit  [500$] ""1"0); 
    
menu_additem(menu"HE Grenade  [3000$] ""2"0); 
    
menu_additem(menu"+50 Health  [3000$] ""3"0); 
    
menu_additem(menu"+50 Armor   [500$] ""4"0); 
    
menu_additem(menu"No Flash    [10000$] ""5"0); 
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL); 
    
menu_display(idmenu0); 
    
    return 
PLUGIN_HANDLED 


public 
shop_afurien(idmenuitem

    if(!
is_user_alive(id)) 
    { 
        
client_printc(id"%s You !gmust !nbe !talive !nto !topen !nthe !gShop!n!"prefix); 
        return 
PLUGIN_HANDLED 
    

    
    if(
item == MENU_EXIT
    { 
        
menu_destroy(menu); 
        return 
PLUGIN_HANDLED
    } 
    
    new 
data[6], iName[64]; 
    new 
accesscallback
    
menu_item_getinfo(menuitemaccessdata,5iName63callback); 
    
    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 destui !gBani!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            if(
cs_get_user_defuse(id))
            {
                
client_printc(id"%s You already have !gDefuse Kit!"prefix); 
                return 
PLUGIN_HANDLED;
            }
        
            
cs_set_user_money(idtmp_money 500
            
give_item(id"item_thighpack"); 
            
give_item(id"item_assaultsuit"); 
            
client_printc(id"%s You bought !gDefuse Kit!"prefix); 
        } 
        case 
2
        { 
            if(
tmp_money 3000)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            if(
user_has_weapon(idCSW_HEGRENADE))
            {
              
client_printc(id"%s You already have !gHeGrenade!"prefix); 
              return 
PLUGIN_HANDLED;
            }
            
            
give_item(id"weapon_hegrenade"
            
cs_set_user_money(idtmp_money 3000
            
client_printc(id"%s You bought !gHE Grenade!"prefix); 
            
        } 
        case 
3
        { 
            if(
tmp_money 3000)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            new 
health get_user_health(id);
            
            if(
health >= 200){
                
client_printc(id"%s You cant have more than !g200 Health!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
health+=50;
            
            
set_user_health(idclamp(health,0,200) == 200 200 health
            
cs_set_user_money(idtmp_money 3000
            
client_printc(id"%s You bought !g+50 HP!"prefix); 
        } 
        case 
4
        { 
            
            if(
tmp_money 500)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
            new 
armor get_user_armor(id);
            
            if(
armor >= 300){
                
client_printc(id"%s You cant have more than !g300 Armor!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
armor+=50
            
            set_user_armor
(idclamp(armor,0,300) == 300 300 armor); 
            
            
cs_set_user_money(idtmp_money 500
            
client_printc(id"%s You bought !g+50 AP!"prefix); 
        } 
        case 
5
        {  
            if(
tmp_money 1000)
            {
                
client_printc(id"%s You dont have enough !gMoney!"prefix); 
                return 
PLUGIN_HANDLED;
            }
            
has_no_flash[id]=true;
            
cs_set_user_money(idtmp_money 1000
            
client_printc(id"%s You bought !gNo Flash!"prefix); 
        }     
    } 
    
    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED


stock client_printc(const id, const input[], any:...) 

    new 
count 1players[32]; 
    static 
msg[191]; 
    
vformat(msg190input3); 
    
    
replace_all(msg190"!g""^x04"); // Green Color 
    
replace_all(msg190"!n""^x01"); // Default Color 
    
replace_all(msg190"!t""^x03"); // Team Color 
    
    
if(id
        
players[0] = id
    else 
        
get_players(playerscount"ch"); 
    
    for (new 
0counti++) 
    { 
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]); 
        
write_byte(players[i]); 
        
write_string(msg); 
        
message_end(); 
    } 



Al3xandru27 07-10-2020 07:03

Re: Help Me Furien Menu
 
Up!

Al3xandru27 07-10-2020 13:48

Re: Help Me Furien Menu
 
Up!

Mordekay 07-10-2020 13:58

Re: Help Me Furien Menu
 
Here

DJEarthQuake 07-10-2020 14:07

Re: Help Me Furien Menu
 
Please reacquaint yourself with the rules. This is so uncouth.

https://forums.alliedmods.net/misc.php?do=showrules

Do not "bump" your threads. Bumping is posting simply to make the thread higher in the forum sort order.
Quote:

Originally Posted by Al3xandru27 (Post 2709529)
Up!

Quote:

Originally Posted by Al3xandru27 (Post 2709582)
Up!


Do not cross-post threads to multiple forums (or posts to multiple threads).
https://forums.alliedmods.net/showthread.php?t=325906
https://forums.alliedmods.net/showthread.php?t=325880

Al3xandru27 07-10-2020 15:09

Re: Help Me Furien Menu
 
Excuse me, it won't happen again

DJEarthQuake 07-10-2020 17:36

Re: Help Me Furien Menu
 
NP.
Upload models I can test my work please.

Al3xandru27 07-11-2020 03:41

Re: Help Me Furien Menu
 
1 Attachment(s)
Models superknife and superknifevip:

DJEarthQuake 07-11-2020 08:54

Re: Help Me Furien Menu
 
Thanks buddy. Script is working now. I used some other models and changed prices a bit. If you want to make the changes yourself, this is the first portion. Otherwise I can post script once I clean up the comments a bit. For instance $10,000 for just a skin is a bit high!

Code:
register_event("CurWeapon","switchweapon","b", "1=1")

Al3xandru27 07-11-2020 09:51

Re: Help Me Furien Menu
 
Looks like I have more issues with this plugin.
The menu does not appear to the others on the server, except me and I do not understand why
If I take superknifevip and then only superknife remains superknifevip always, it doesn't change.
Superknife and vip superknife give the same damage .. damage as the default knife


All times are GMT -4. The time now is 09:17.

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