Jump to content

c4 strieps


marvel_team

Recommended Posts

Server : MARVEL.RANGFORT.RO

Nick : brick_bazuka
Grad server : detinator
La ce doriţi ajutor? : 

Deci doresc sa inlocuiesc ledul de la c4 cu alt model dar nu reusesc.

Eu cred ca am nevoie de un plugin ceva ,adica nu il pot baga in stripes,dau rr la pc si gata merge ca nu-i asa

imi apare tot led-ul vechi...deci stie cineva ?

 

Link to comment
Share on other sites

 

Intro
Bomb is the one of the most interesting aspects of the CS scripting. I saw many bomb scripting questions/mistakes. So i decided to create the "CS Bomb Scripting FAQ/Tutorial".

Requirements
You should be familiar with the basics of the AMXX scripting. Fakemeta Utilities (http://forums.alliedmods.net/showthread.php?t=28284) functions is used here. To get the player's index (only inside "logevent_function_p") you have to use:stock get_loguser_index() {
new loguser[80], name[32]
read_logargv(0, loguser, 79)
parse_loguser(loguser, name, 31)

return get_user_index(name)
}Example:public logevent_function_p() {
new id = get_loguser_index()
// ...
}

1. Player/Bomb// Is bomb dropped/carried?
if (fm_find_ent_by_class(-1, "weapon_c4"))

// Is bomb dropped?
new bomb = fm_find_ent_by_class(-1, "weapon_c4")
if (bomb && pev(bomb, pev_owner) > get_maxplayers())

// Is bomb carried/who is the carrier?
new carrier = 0, ownerent, bomb = fm_find_ent_by_class(-1, "weapon_c4")
if (bomb && (ownerent = pev(bomb, pev_owner)) <= get_maxplayers())
carrier = ownerent
if (carrier) // we have the carrier
else // we do not have a carrier

// Is given player has the bomb?
if (user_has_weapon(id, CSW_C4)) // method #1
if (pev(id, pev_weapons) & (1<<CSW_C4)) // method #2
if (fm_find_ent_by_owner(-1, "weapon_c4", id)) // method #3

// How to transfer the bomb from one player to another?
fm_transfer_user_gun(carrier, recipient, CSW_C4) // returns true on success

// How to force a player to drop the bomb?
engclient_cmd(id, "drop", "weapon_c4")

// How to remove the dropped bomb?
new weapbox, bomb = fm_find_ent_by_class(-1, "weapon_c4")
if (bomb && (weapbox = pev(bomb, pev_owner)) > get_maxplayers()) {
dllfunc(DLLFunc_Think, weapbox) // will remove weaponbox + weapon_c4 entity pair
// remove blinking red bomb mark on the radar
message_begin(MSG_ALL, get_user_msgid("BombPickup"))
message_end()
}

// How to give the bomb to a player?
fm_give_item(id, "weapon_c4")
// use cs_set_user_plant(id) to allow planting

// How to strip the bomb from a player?
engclient_cmd(id, "weapon_c4")
cs_set_user_bpammo(id, CSW_C4, 0)
engclient_cmd(id, "lastinv")
// remove bomb hud icon
message_begin(MSG_ONE, get_user_msgid("StatusIcon"), _, id)
write_byte(0)
write_string("c4")
message_end()

// Is bomb planted/how to remove the planted bomb?
new bomb
if ((bomb = fm_find_ent_by_model(-1, "grenade", "models/w_c4.mdl"))) {
// bomb is planted
fm_remove_entity(bomb) // remove the planted bomb
}

2. Drop/Collect// Player spawned with the bomb event
register_logevent("logevent_function_p", 3, "2=Spawned_With_The_Bomb")

// Bomb dropped (including disconnect/death) event
register_logevent("logevent_function_p", 3, "2=Dropped_The_Bomb")
// use is_user_alive/is_user_connected to check for disconnect/death

// Bomb collected (except spawn) event
register_logevent("logevent_function_p", 3, "2=Got_The_Bomb")

// Bomb gained (including spawn/give_item) event
register_event("WeapPickup", "event_function", "be", "1=6")

3. Plant/Defuse// Bomb planting started event
register_event("BarTime", "event_function", "be", "1=3")

// Bomb planted event
register_logevent("logevent_function_p", 3, "2=Planted_The_Bomb")

// Bomb defusion started event
register_event("BarTime", "event_function", "be", "1=5", "1=10")

// Bomb defusion (without kit) started event
register_logevent("logevent_function_p", 3, "2=Begin_Bomb_Defuse_Without_Kit")

// Bomb defusion (with kit) started event
register_logevent("logevent_function_p", 3, "2=Begin_Bomb_Defuse_With_Kit")

// Bomb defused event
register_logevent("logevent_function_p", 3, "2=Defused_The_Bomb")

// Bomb planting/defusion canceled event
register_event("BarTime", "event_function", "b", "1=0")
register_event("CurWeapon", "event_function", "be", "2!6")
// you must be sure that bomb planting/defusion is in progress!

// Target saved event
register_logevent("logevent_function", 6, "3=Target_Saved")

4. Explosion// Target bombed (right before round end) event
register_logevent("logevent_function", 6, "3=Target_Bombed")

// Planted bomb exploded (before/after round end) event (discovered by Ryan)
register_event("23", "event_function", "a", "1=17", "6=-105", "7=17")

// Player killed by bomb explosion event(forward) (discovered by Brad/VEN)
// will not work if victim is killed by env_explosion entity that is triggered by explosion
public client_death(killer, victim, wpnindex, hitplace, TK) {
if (wpnindex == CSW_C4)
}

5. Targets// Is player at the bomb target (func_bomb_target)?
// Note: there are no good way to detect if player is at the info_bomb_target
new target = -1, class[] = "func_bomb_target", bool:is_inside = false
while ((target = fm_find_ent_by_class(target, class))) {
if (!fm_boxents_distance(index, target)) {
is_inside = true
break
}
}
if (is_inside)

// Is map contain bomb targets?
if (fm_find_ent_by_class(-1, "func_bomb_target") || fm_find_ent_by_class(-1, "info_bomb_target"))

// How to remove bomb targets?
new target = -1, classname[] = "func_bomb_target"
while ((target = fm_find_ent_by_class(target, classname)))
fm_remove_entity(target)
classname = "info_bomb_target"
while ((target = fm_find_ent_by_class(target, classname)))
fm_remove_entity(target)

 

Tut by VEN.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...

 

/* Plugin generated by AMXX-Studio */

#include
#include
#include
#include

#define PLUGIN "Bomb Blast"
#define VERSION "0.4"
#define AUTHOR "K.K.Lv"

new HamHook:g_BombThink

new g_Bomb

new g_SpriteCircle

new Float:g_fExplodeTime
new Float:g_fNextBlastGameTime

new g_pCvarColor

public plugin_precache()
{
g_SpriteCircle = precache_model( "sprites/shockwave.spr" )
}

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

g_pCvarColor = register_cvar( "bb_color", "250250250" ) //RRRGGGBBB

if( find_ent_by_class( FM_NULLENT, "func_bomb_target" ) || find_ent_by_class( FM_NULLENT, "info_bomb_target" ) )
{
g_BombThink = RegisterHam( Ham_Think, "grenade", "Bomb_Think", 1 )

register_event( "HLTV", "Stop", "a", "1=0", "2=0" )
register_logevent( "Stop", 2, "1=Round_End" )

register_logevent( "PlantedBomb", 3, "2=Planted_The_Bomb" )
}
}

public Stop()
{
g_Bomb = 0
DisableHamForward( g_BombThink)
}

public PlantedBomb()
{
new C4 = FM_NULLENT
while( ( C4 = find_ent_by_class( C4, "grenade" ) ) )
{
if ( get_pdata_int( C4, 96 ) & ( 1<<8 ) )
{
g_Bomb = C4
g_fExplodeTime = get_pdata_float( g_Bomb, 100 )
EnableHamForward( g_BombThink )

g_fNextBlastGameTime = 0.0
break
}
}
}

public Bomb_Think( iEnt )
{
if ( g_Bomb != iEnt )
return

new Float:fGameTime = get_gametime()
if( g_fNextBlastGameTime > fGameTime )
return

new Float:fTime, iTime, Float:fThinkTime

fTime = g_fExplodeTime - fGameTime
iTime = floatround( fTime )

if ( iTime > 13 ) fThinkTime = 1.0
else if ( iTime > 7 ) fThinkTime = 0.5
else fThinkTime = 0.3

g_fNextBlastGameTime = fGameTime + fThinkTime

create_blast_circle( iEnt )
}

public create_blast_circle( iEnt ) {
new Float:fOrigin[ 3 ]

pev( iEnt, pev_origin, fOrigin )

new szColor[ 12 ], iColor[ 3 ]
get_pcvar_string( g_pCvarColor, szColor, charsmax( szColor ) )

iColor[ 2 ] = str_to_num( szColor[ 6 ] )

szColor[ 6 ] = 0
iColor[ 1 ] = str_to_num( szColor[ 3 ] )

szColor[ 3 ] = 0
iColor[ 0 ] = str_to_num( szColor[ 0 ] )

engfunc( EngFunc_MessageBegin, MSG_BROADCAST, SVC_TEMPENTITY, fOrigin )
write_byte( TE_BEAMCYLINDER )
engfunc( EngFunc_WriteCoord, fOrigin[ 0 ] )
engfunc( EngFunc_WriteCoord, fOrigin[ 1 ] )
engfunc( EngFunc_WriteCoord, fOrigin[ 2 ] )
engfunc( EngFunc_WriteCoord, fOrigin[ 0 ] )
engfunc( EngFunc_WriteCoord, fOrigin[ 1 ] )
engfunc( EngFunc_WriteCoord, fOrigin[ 2 ] + 125 )
write_short( g_SpriteCircle )
write_byte( 0 )
write_byte( 1 )
write_byte( 6 )
write_byte( 8 )
write_byte( 1 )
write_byte( iColor[ 0 ] )
write_byte( iColor[ 1 ] )
write_byte( iColor[ 2 ] )
write_byte( 128 )
write_byte( 5 )
message_end()
}

 

Link to comment
Share on other sites

Am adaugat si eu acest plugin , verifica pagina 2 , nu este ceea ce caut eu :|

 

 

plus ca la sursa ta ce mi-ai lasat`o nu sunt adaugate modulele :

 

engine , fakemeta etc deci n`o sa mearga compilat :)

multumes oricum pentru gest , am renuntat la fel dupa cat am incercat sa-l fac / caut....

acest plugin adauga un efect la bomba , nu schimba ledul la c4 ....

Link to comment
Share on other sites

  • 4 months later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...