AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with give item and restrict all weapons (https://forums.alliedmods.net/showthread.php?t=134583)

lashsh 08-06-2010 17:17

help with give item and restrict all weapons
 
help with give item and restrict all weapons


PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Knife Mod + respawn"
#define VERSION "0.1"
#define AUTHOR "LaSsHhH"
#define CHECKS 10

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)    
}


public 
client_putinserver(id

         
set_task(1.0"_checkClient"id__"a"CHECKS); 
}

public 
_checkClient(id

         if(!
is_user_connected(id) || is_user_alive(id) || (cs_get_user_team(id) != CS_TEAM_CT) || (cs_get_user_team(id) != CS_TEAM_T)) 

         
ExecuteHamB(Ham_CS_RoundRespawnid); 

    
give_item(id"weapon_knife")



vL. 08-06-2010 19:57

Re: help with give item and restrict all weapons
 
Much useless junk in your script.

Try this one, it removes the buyzone, so no one can buy anything :)

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <engine>
#include <hamsandwich>

#include <hamsandwich>

#define PLUGIN "Knife Mod + respawn"
#define VERSION "0.1"
#define AUTHOR "LaSsHhH"

// Macros
#if cellbits == 32
#define OFFSET_BZ 235
#else
#define OFFSET_BZ 268
#endif

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
RegisterHam(Ham_Spawn"player""Fwd_Ham_Spawn_Post"1); // Spawns
    
    
register_message(get_user_msgid("StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon
    
    // Remove buyzone on map
    
remove_entity_name("info_map_parameters");
    
remove_entity_name("func_buyzone");
    
    
// Create own entity to block buying
    
new iEntity create_entity("info_map_parameters");
    
    
DispatchKeyValue(iEntity"buying""3");
    
DispatchSpawn(iEntity);
}

public 
Fwd_Ham_Spawn_Post(id

    
strip_user_weapons(id);
    
    
give_item(id"weapon_knife");
}

public 
MsgStatusIcon(msg_idmsg_destid)
{
    new 
szIcon[8];
    
get_msg_arg_string(2szIcon7);
    
    static const 
BuyZone[ ] = "buyzone";
    
    if(
equal(szIconBuyZone))
    {
        
set_pdata_int(idOFFSET_BZget_pdata_int(idOFFSET_BZ5) & ~(<< 0), 5)
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


PS: Tested, works.

Zpoke 08-07-2010 19:44

Re: help with give item and restrict all weapons
 
or this one..

Tell me if im whrong :oops:

PHP Code:

#include < amxmodx >
#include < cstrike >
#include < fun >
#include < hamsandwich >
static const g_szBuyCmds[ ][ ] = {
    
"usp""glock""deagle""p228""elites""fn57""m3""xm1014""mp5""tmp""p90""mac10""ump45""ak47"
    
"galil""famas""sg552""m4a1""aug""scout""awp""g3sg1""sg550""m249""vest""vesthelm""flash""hegren",
    
"sgren""defuser""nvgs""shield""primammo""secammo""km45""9x19mm""nighthawk""228compact""12gauge",
    
"autoshotgun""smg""mp""c90""cv47""defender""clarion""krieg552""bullpup""magnum""d3au1""krieg550",
    
"buyammo1""buyammo2"

public 
plugin_init( ) {
    
register_plugin"Strip Weapons""1.0""Zpoke" );
 
    
RegisterHamHam_Spawn"player""FwdHamSpawnPlayer_Post");    
 
    for( new 
isizeof g_szBuyCmdsi++ )
        
register_clcmdg_szBuyCmds], "BlockBuyCmd" 
}
public 
BlockBuyCmdid ) return PLUGIN_HANDLED;
public 
FwdHamSpawnPlayer_Postid ) {
    if( 
is_user_aliveid ) ) {
        
strip_user_weaponsid );
        
cs_set_user_moneyid);
        
give_itemid"weapon_knife" );
    }



lashsh 08-09-2010 06:55

Re: help with give item and restrict all weapons
 
thanks :))

lashsh 08-09-2010 07:00

Re: help with give item and restrict all weapons
 
Quote:

Much useless junk in your script.

Try this one, it removes the buyzone, so no one can buy anything

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <engine>
#include <hamsandwich>

#include <hamsandwich>

#define PLUGIN "Knife Mod + respawn"
#define VERSION "0.1"
#define AUTHOR "LaSsHhH"

// Macros
#if cellbits == 32
#define OFFSET_BZ 235
#else
#define OFFSET_BZ 268
#endif

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

RegisterHam(Ham_Spawn, "player", "Fwd_Ham_Spawn_Post", 1); // Spawns

register_message(get_user_msgid("StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon

// Remove buyzone on map
remove_entity_name("info_map_parameters");
remove_entity_name("func_buyzone");

// Create own entity to block buying
new iEntity = create_entity("info_map_parameters");

DispatchKeyValue(iEntity, "buying", "3");
DispatchSpawn(iEntity);
}

public Fwd_Ham_Spawn_Post(id)
{
strip_user_weapons(id);

give_item(id, "weapon_knife");
}

public MsgStatusIcon(msg_id, msg_dest, id)
{
new szIcon[8];
get_msg_arg_string(2, szIcon, 7);

static const BuyZone[ ] = "buyzone";

if(equal(szIcon, BuyZone))
{
set_pdata_int(id, OFFSET_BZ, get_pdata_int(id, OFFSET_BZ, 5) & ~(1 << 0), 5)

return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;
}
PS: Tested, works.
thanks

please register cvar for respawn :)))

sorry my bad english

lashsh 08-09-2010 12:59

Re: help with give item and restrict all weapons
 
1 Attachment(s)
how register cvar from respawn time and respawn on or off? on this plugin

sorry my bad english

example

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init()
{
       
register_plugin("amx_respawn","1.0","GHW_Chronic")
    
register_event("DeathMsg","death_msg","a")
    
register_event("ShowMenu","team_select","b","4&Team_Select")
    
register_event("VGUIMenu","team_select","b","1=2")

    
register_cvar("respawn_on","0")
    
register_cvar("respawn_safetytime","3")

    
register_menucmd(register_menuid("Terrorist_Select",1), 511,"team_select")
    
register_menucmd(register_menuid("CT_Select",1),511,"team_select")
    
register_clcmd("joinclass","team_select")
}

public 
team_select(id)
{
    if(
get_cvar_num("amx_respawn")) 
    {
        
set_task(1.6,"respawn",id)
    }
}

public 
death_msg()
{
    new 
id=read_data(2)
    new 
team[32]
    
get_user_team(id,team,31)
    if(
get_cvar_num("amx_respawn") && containi(team,"spec")==-1)  
    {
        
spawn(id)
        
set_task(0.6,"respawn",id)
        
set_task(0.7,"respawn2",id)
    }
}

public 
respawn(id)
{
    
spawn(id)


public 
respawn2(id)
{
    
spawn(id)
    
set_user_health(id,230500)
    
set_task(get_cvar_float("amx_respawn_safetytime"),"health",id)
    
client_print(id,print_chat,"[AMXX] You are invincible for %d seconds.",get_cvar_num("amx_respawn_safetytime"))
    
set_user_rendering(id,kRenderFxGlowShell,0,255,0,kRenderTransAlpha,255)


public 
health(id)
{
    
set_user_health(id,100)
    
client_print(id,print_chat,"[AMXX] You are no longer invincible.")
    
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255)




All times are GMT -4. The time now is 00:12.

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