Raised This Month: $51 Target: $400
 12% 

GiftBox Cs1.6 Fix [ZP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NITRO_GOD
Member
Join Date: Mar 2017
Location: De_dust2
Old 07-31-2017 , 11:37   GiftBox Cs1.6 Fix [ZP]
Reply With Quote #1

Hi everyone,
i need a little help.I need the following things:

1) Bugs:When user becomes zombie if he has weapon in hand it creates a giftbox on the zombie which makes the zombies stuck inside the giftbox.

2) Please add a chance to get empty box as well. the box is empty.

3) Please make it like we can get any extra item also randomly but increase the chance to get empty box.

4) Even add a chance for zombies to also get any random extra item.

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

#define VERSION "1.2"

new const BOX_CLASSNAME[ ] = "func_bonusbox" ;

new const BOX_MODEL[ ] = "models/bonusbox.mdl" ;

new const BOX_SPRITE[ ] = "sprites/bonusbox_sprite.spr" ;

new g_iSprite ;

new g_iCvars[ 6 ] ;

new const g_szRestrictedEntities[ ][ ] = {

	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_smokegrenade"
}

public plugin_init( ) {

	register_plugin( "[ZP] GiftBox", VERSION, "DoNii" ) ;

	RegisterHam( Ham_Touch, "weaponbox", "fw_HamTouchPre", 0 ) ;
	RegisterHam( Ham_Touch, "armoury_entity", "fw_HamTouchPre", 0 ) ;
	
	RegisterHam( Ham_Touch, "info_target", "fw_HamTouchPreInfoTarget", 0 ) ;
	
	g_iCvars[ 0 ] = register_cvar( "giftbox_winhp", "30" ) ;
	g_iCvars[ 1 ] = register_cvar( "giftbox_winarmor", "30" ) ;
	g_iCvars[ 2 ] = register_cvar( "giftbox_losehp", "15" ) ;
	g_iCvars[ 3 ] = register_cvar( "giftbox_winhenades", "3" ) ;
	g_iCvars[ 4 ] = register_cvar( "giftbox_winflashbangs", "2" ) ;
	g_iCvars[ 5 ] = register_cvar( "giftbox_winsmokenades", "1" ) ;

	register_cvar( "giftbox_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED ) ;
}

public plugin_precache( ) {

	precache_model( BOX_MODEL ) ;
	
	g_iSprite = precache_model( BOX_SPRITE ) ;
}

public fw_HamTouchPre( iEnt, iToucher ) {

	if( ! pev_valid( iEnt ) )
	return HAM_IGNORED ;

	new szToucherClass[ 32 ], szEntClass[ 32 ] ;
	pev( iToucher, pev_classname, szToucherClass, charsmax( szToucherClass ) ) ;
	pev( iEnt, pev_classname, szEntClass, charsmax( szEntClass ) ) ;
	
	if( equal( szToucherClass, "weaponbox" ) ) {
		
		for( new i ; i < sizeof g_szRestrictedEntities ; i++ ) {
			
			if( equal( szToucherClass, g_szRestrictedEntities[ i ] ) || equal( szEntClass, g_szRestrictedEntities[ i ] ) )
			return HAM_IGNORED ;
		}
		
		new iEntBox = create_entity( "info_target" ) ;
		
		new Float:vEntOrigin[ 3 ] ;
		entity_get_vector( iEnt, EV_VEC_origin, vEntOrigin ) ;
		
		entity_set_vector( iEntBox, EV_VEC_origin, vEntOrigin ) ;
		entity_set_string( iEntBox, EV_SZ_classname, BOX_CLASSNAME ) ;
		entity_set_model( iEntBox, BOX_MODEL ) ;
		entity_set_int( iEntBox, EV_INT_solid, SOLID_BBOX ) ;
		entity_set_int( iEntBox, EV_INT_movetype, MOVETYPE_PUSHSTEP ) ;
		entity_set_size( iEntBox, Float:{ -2.0,-2.0,-2.0 },Float:{ 5.0,5.0,5.0 } ) ;
		
		engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vEntOrigin, 0 )
		write_byte( TE_BEAMCYLINDER ) // TE id
		engfunc( EngFunc_WriteCoord, vEntOrigin[ 0 ] ) // x
		engfunc( EngFunc_WriteCoord, vEntOrigin[ 1 ] ) // y
		engfunc( EngFunc_WriteCoord, vEntOrigin[ 2 ] ) // z
		engfunc( EngFunc_WriteCoord, vEntOrigin[ 0 ] ) // x axis
		engfunc( EngFunc_WriteCoord, vEntOrigin[ 1 ] ) // y axis
		engfunc( EngFunc_WriteCoord, vEntOrigin[ 2 ] + 385.0 ) // z axis
		write_short( g_iSprite ) // sprite
		write_byte( 0 ) // startframe
		write_byte( 0 ) // framerate
		write_byte( 4 ) // life
		write_byte( 1 ) // width
		write_byte( 0 ) // noise
		write_byte( random_num( 128, 255 ) ) // red
		write_byte( random_num( 128, 255 ) ) // green
		write_byte( random_num( 128, 255 ) ) // blue
		write_byte( 25 ) // brightness
		write_byte( 0 ) // speed
		message_end( )
		
		engfunc( EngFunc_DropToFloor, iEntBox ) ;

		engfunc( EngFunc_RemoveEntity, iEnt ) ; 
		
		set_rendering( iEntBox, kRenderFxGlowShell, random_num( 128, 255 ), random_num( 128, 255 ), random_num( 128, 255 ), kRenderFxNone, 255 ) ;
	}
	
	return HAM_IGNORED ;
}

public fw_HamTouchPreInfoTarget( iEnt, iToucher ) {

	if( zp_get_user_zombie( iToucher ) || zp_get_user_nemesis( iToucher ) )
	return HAM_IGNORED ;
	
	new szClassNameEnt[ 32 ], szClassNamePlayer[ 32 ] ;
	pev( iEnt, pev_classname, szClassNameEnt, charsmax( szClassNameEnt ) ) ;
	pev( iToucher, pev_classname, szClassNamePlayer, charsmax( szClassNamePlayer ) ) ;

	if( ! equal( szClassNameEnt, BOX_CLASSNAME ) || ! equal( szClassNamePlayer, "player" ) )
	return HAM_IGNORED ;

	entity_set_int( iEnt, EV_INT_solid, SOLID_NOT ) ;
	entity_set_int( iEnt, EV_INT_effects, MOVETYPE_PUSHSTEP ) ;
	
	engfunc( EngFunc_RemoveEntity, iEnt ) ;
	
	new iRandomNum = random_num( 1, 6 ) ;
	
	switch( iRandomNum ) {
		
	case 1 : {
			
			set_user_health( iToucher, get_user_health( iToucher ) + get_pcvar_num( g_iCvars[ 0 ] ) ) ;
			
			client_print( iToucher, print_chat, "[GiftBox] You Just Won %d HP", get_pcvar_num( g_iCvars[ 0 ] ) );	

			set_hudmessage( 0, 255, 0, 0.40, 0.35, 0, 6.0, 3.0 ) ;
			show_hudmessage( iToucher, "[GiftBox] You Just Won %d HP", get_pcvar_num( g_iCvars[ 0 ] ) ) ;
		}
		
	case 2 : {
			
			set_user_armor( iToucher, get_user_armor( iToucher ) + get_pcvar_num( g_iCvars[ 1 ] ) ) ;
			
			client_print( iToucher, print_chat, "[GiftBox] You Just Won %d ARMOR", get_pcvar_num( g_iCvars[ 1 ] ) ) ;	

			set_hudmessage( 0, 255, 0, 0.40, 0.35, 0, 6.0, 3.0 ) ;
			show_hudmessage( iToucher, "[GiftBox] You Just Won %d ARMOR", get_pcvar_num( g_iCvars[ 1 ] ) ) ;
		}
		
	case 3 : {
			
			set_user_health( iToucher, get_user_health( iToucher ) - get_pcvar_num( g_iCvars[ 2 ] ) ) ;
			
			client_print( iToucher, print_chat, "[GiftBox] You Just Lost %d HP", get_pcvar_num( g_iCvars[ 2 ] ) ) ;	

			set_hudmessage( 0, 255, 0, 0.40, 0.35, 0, 6.0, 3.0 ) ;
			show_hudmessage( iToucher, "[GiftBox] You Just Lost %d HP", get_pcvar_num( g_iCvars[ 2 ] ) ) ;
		}
		
	case 4 : {
			
			
			give_item( iToucher, "weapon_hegrenade" ) ;
			cs_set_user_bpammo( iToucher, CSW_HEGRENADE, get_pcvar_num( g_iCvars[ 3 ] ) ) ;
			
			client_print( iToucher, print_chat, "[GiftBox] You Just Won %d HE Grenade%s", get_pcvar_num( g_iCvars[ 3 ] ), get_pcvar_num( g_iCvars[ 3 ] ) != 1 ? "s" : "" ) ;	

			set_hudmessage( 0, 255, 0, 0.40, 0.35, 0, 6.0, 3.0 ) ;
			show_hudmessage( iToucher, "[GiftBox] You Just Won %d HE Grenade%s", get_pcvar_num( g_iCvars[ 3 ] ), get_pcvar_num( g_iCvars[ 3 ] ) != 1 ? "s" : "" ) ;	
		}
		
	case 5 : {
			
			give_item( iToucher, "weapon_flashbang" ) ;
			cs_set_user_bpammo( iToucher, CSW_FLASHBANG, get_pcvar_num( g_iCvars[ 4 ] ) ) ;
			
			client_print( iToucher, print_chat, "[GiftBox] You Just Won %d Flashbang%s", get_pcvar_num( g_iCvars[ 4 ] ), get_pcvar_num( g_iCvars[ 4 ] ) != 1 ? "s" : "" ) ;	

			set_hudmessage( 0, 255, 0, 0.40, 0.35, 0, 6.0, 3.0 ) ;
			show_hudmessage( iToucher, "[GiftBox] You Just Won %d Flashbang%s", get_pcvar_num( g_iCvars[ 4 ] ), get_pcvar_num( g_iCvars[ 4 ] ) != 1 ? "s" : "" ) ;	
		}

	case 6 : {
			
			give_item( iToucher, "weapon_smokegrenade" ) ;
			cs_set_user_bpammo( iToucher, CSW_SMOKEGRENADE, get_pcvar_num( g_iCvars[ 5 ] ) ) ;
			
			client_print( iToucher, print_chat, "[GiftBox] You Just Won %d Smoke Grenade%s", get_pcvar_num( g_iCvars[ 5 ] ), get_pcvar_num( g_iCvars[ 5 ] ) != 1 ? "s" : "" ) ;	

			set_hudmessage( 0, 255, 0, 0.40, 0.35, 0, 6.0, 3.0 ) ;
			show_hudmessage( iToucher, "[GiftBox] You Just Won %d Smoke Grenade%s", get_pcvar_num( g_iCvars[ 5 ] ), get_pcvar_num( g_iCvars[ 5 ] ) != 1 ? "s" : "" ) ;	
		}
	}
	
	return HAM_IGNORED ;
}

public zp_round_ended( ) {

	new iEnt = -1 ;

	while( ( iEnt = find_ent_by_class( iEnt, BOX_CLASSNAME ) ) != 0 ) {

		if( is_valid_ent( iEnt ) )
		remove_entity( iEnt ) ; 
	}
}

public zp_round_has_started( ) {

	new iEnt = -1 ;

	while( ( iEnt = find_ent_by_class( iEnt, BOX_CLASSNAME ) ) != 0 ) {

		if( is_valid_ent( iEnt ) )
		remove_entity( iEnt ) ; 
	}
}
__________________
My Work in zppv [RaDNoX] http://zppv.boards.net/thread/2562/m...tems-zp-radnox

Join zppv for help in Zombie Plague!

Last edited by NITRO_GOD; 07-31-2017 at 11:38.
NITRO_GOD is offline
Send a message via Skype™ to NITRO_GOD
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-31-2017 , 11:57   Re: GiftBox Cs1.6 Fix [ZP]
Reply With Quote #2

ask @DoNii

Why do you have to immediately post the code here?

Ask him in the forum that you took the code and he will help you there
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
NITRO_GOD
Member
Join Date: Mar 2017
Location: De_dust2
Old 08-01-2017 , 10:54   Re: GiftBox Cs1.6 Fix [ZP]
Reply With Quote #3

Quote:
Originally Posted by Fuck For Fun View Post
ask @DoNii

Why do you have to immediately post the code here?

Ask him in the forum that you took the code and he will help you there
Already did and waited for long.... but he seems to be offline
__________________
My Work in zppv [RaDNoX] http://zppv.boards.net/thread/2562/m...tems-zp-radnox

Join zppv for help in Zombie Plague!
NITRO_GOD is offline
Send a message via Skype™ to NITRO_GOD
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-01-2017 , 11:24   Re: GiftBox Cs1.6 Fix [ZP]
Reply With Quote #4

Be patient...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



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 12:17.


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