AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Requst Edite Sma (https://forums.alliedmods.net/showthread.php?t=339737)

mohanad_2022 09-29-2022 00:26

Requst Edite Sma
 
2 Attachment(s)
Hello EveryBuddy

here is sma if normal weapon menu , when i add it on the server , it should appear the normal weapons menu for players when they respawned as human only

but it doesnot appear untill you type on console "weapon" .. and the 2nd bug is that this menu should be used for 1 time , Exampe : when player use the appeared menu on The beginning of the tour and choose a weapon , they can't use it again when they use it from game menu "M>2>1" and they will get massage "You already bought a weapon"

so guys i hope somone could help me on that , and big thanks for you

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <colorchat>
#include <csx>
#include <zp_level_system>
#include <zombieplague>
#include <xs>

public plugin_init()
{
    
register_plugin("My Menu""2.0""Me");
    
register_clcmd("weapon""menu_buy1"_"Select team");
    
register_clcmd("weapon""menu_buy1"_"Select team");
    
register_concmd("weapon""menu_buy1"_"Select team");
    
}

public 
ShowMenu(id)
{
    new 
menu menu_create("\yWeapon Normal""Csw4");
    
        
menu_additem(menu"\wWeapon \r|| \yM4A1 \r||"""0); // case 0
        
menu_additem(menu"\wWeapon \r|| \yAk47 \r||"""0); // case 1
        
menu_additem(menu"\wWeapon \r|| \yM3 \r||"""0); // case 1
        
menu_additem(menu"\wWeapon \r|| \yXM1014 \r||"""0); // case 1

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
Csw4(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0:
        {
            
fm_give_item(id"weapon_m4a1")
            
fm_give_item(id"weapon_m4a1")
            
menu_buy2(id)
        }
        case 
1:
        {
            
fm_give_item(id"weapon_ak47")
            
fm_give_item(id"weapon_ak47")
            
menu_buy2(id)
        }
        case 
2:
        {
            
fm_give_item(id"weapon_m3")
            
fm_give_item(id"weapon_m3")
            
menu_buy2(id)
        }
        case 
3:
        {
            
fm_give_item(id"weapon_xm1014")
            
fm_give_item(id"weapon_xm1014")
            
menu_buy2(id)
        }
    }
    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;
}

stock fm_give_item(id, const item[])
{
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem))
    if (!
pev_valid(ent)) return;
    
    static 
Float:originF[3]
    
pev(idpev_originoriginF)
    
set_pev(entpev_originoriginF)
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
    
dllfunc(DLLFunc_Spawnent)
    
    static 
save
    save 
pev(entpev_solid)
    
dllfunc(DLLFunc_Touchentid)
    if (
pev(entpev_solid) != save)
        return;
    
    
engfunc(EngFunc_RemoveEntityent)
}

public 
menu_buy1(id)
{
    if(!
is_user_connected(id))
        return 
PLUGIN_HANDLED;
    else if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id))
    {
        
ChatColor(id"!g[CSo]!y Available only !tPlayer!y.")
        return 
PLUGIN_HANDLED;
    }    
    
ShowMenu(id)
}


public 
menu_buy2(id)
{
    new 
menu menu_create("\yWeapon Pistor""Csw5");
    
        
menu_additem(menu"\wUSP"""0); // case 0
        
menu_additem(menu"\wGlock 18C"""0); // case 1
        
menu_additem(menu"\wDeagle"""0); // case 1
        
menu_additem(menu"\wDual Ifniity"""0); // case 1

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
Csw5(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0:
        {
            
fm_give_item(id"weapon_usp")
            
fm_give_item(id"weapon_usp")
            
fm_give_item(id"weapon_hegrenade")
            
fm_give_item(id"weapon_flashbang")
            
fm_give_item(id"weapon_smokegrenade")
        }
        case 
1:
        {
            
fm_give_item(id"weapon_glock18")
            
fm_give_item(id"weapon_glock18")
            
fm_give_item(id"weapon_hegrenade")
            
fm_give_item(id"weapon_flashbang")
            
fm_give_item(id"weapon_smokegrenade")
        }
        case 
2:
        {
            
fm_give_item(id"weapon_deagle")
            
fm_give_item(id"weapon_deagle")
            
fm_give_item(id"weapon_hegrenade")
            
fm_give_item(id"weapon_flashbang")
            
fm_give_item(id"weapon_smokegrenade")
        }
        case 
3:
        {
            
fm_give_item(id"weapon_elite")
            
fm_give_item(id"weapon_elite")
            
fm_give_item(id"weapon_hegrenade")
            
fm_give_item(id"weapon_flashbang")
            
fm_give_item(id"weapon_smokegrenade")
                }
    }
    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;
}


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



i will attach the .inc files if needed


All times are GMT -4. The time now is 15:40.

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