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

Help on Gambit Script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kenchi
Member
Join Date: Feb 2005
Location: Steam
Old 05-06-2006 , 05:07   Help on Gambit Script
Reply With Quote #1

I was trying to have flashbang and smokegrenade along with the default hegrenade of gambit
this is what I did and didn't get errors in recompiling

if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
shGiveWeapon(id, "weapon_hegrenade")
shGiveWeapon(id, "weapon_flashbang")
shGiveWeapon(id, "weapon_smokegrenade")
}

but the problem is, I can't reload my flashbang and smokegrenade after they're being used up, but when I used up the hegrenade, that's the time all of the grenades "reloaded"

also having a hard time knowing about this number 12 in this line:

#define AMMOX_HEGRENADE 12

would it work with this also?

#define AMMOX_FLASHBANG 12
#define AMMOX_SMOKEGRENADE 12

also I was trying to put trails on both the flashbang and smokegrenade but failed
I added this line:

new const HEGRENADE_MODEL[] = "models/w_hegrenade.mdl"
new const FLASHBANG_MODEL[] = "models/w_flashbang.mdl"
new const SMOKEGRENADE_MODEL[] = "models/w_smokegrenade.mdl"


and replace AMMOX_HEGRENADE and HEGRENADE_MODEL with the above mentioned
and added the same lines like the ones below, made three of them to incorporate each of the grenades
there was no error, but the flashbang and smokegrenade had no trails


if ( iAmmoType == AMMOX_HEGRENADE && gHasGambitPower[id] ) {
if (iAmmoCount == 0) {
set_task(get_cvar_float("gambit_grenadetimer" ), "gambit_weapons", id)

if ( !gPlayerUltimateUsed[id] ) {
// Have to Find the current HE grenade
new iCurrent = -1
while ( ( iCurrent = FindEntity(iCurrent, "grenade") ) > 0 ) {
new string[32]
Entvars_Get_String(iCurrent, EV_SZ_model, string, 31)

if ( id == Entvars_Get_Edict(iCurrent, EV_ENT_owner) && equali(HEGRENADE_MODEL, string)) {
new Float:glowColor[3] = {225.0, 0.0, 20.0}

// Make the nade glow
Entvars_Set_Int(iCurrent, EV_INT_renderfx, kRenderFxGlowShell)
Entvars_Set_Vector(iCurrent, EV_VEC_rendercolor, glowColor)

// Make the nade a bit invisible to make glow look better
Entvars_Set_Int(iCurrent, EV_INT_rendermode, kRenderTransAlpha)
Entvars_Set_Float(iCurrent, EV_FL_renderamt, 100.0 )

// Make a trail
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
write_byte(22) //TE_BEAMFOLLOW
write_short(iCurrent) // entity:attachment to follow
write_short(gGrenTrail) // sprite index
write_byte(10) // life in 0.1's
write_byte(10) // line width in 0.1's
write_byte(225) // colour
write_byte(90)
write_byte(102)
write_byte(255) // brightness
message_end()
}
}
}
}
else if (iAmmoCount > 0) {
// Got a new nade remove the timer
remove_task(id)
}
}


Thanks in Advance
Really like experimenting
__________________
CS is Love, CS is the source of Love. CS made me the person I am today, ^_º A little bit weird... rofl


[IMG]http://img14.**************/img14/3522/20526a.gif[/IMG]
Kenchi is offline
Send a message via MSN to Kenchi Send a message via Yahoo to Kenchi
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 05-06-2006 , 11:54  
Reply With Quote #2

AMMOX_FLASHBANG should be 11, and AMMOX_SMOKEGRENADE should be 13.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Kenchi
Member
Join Date: Feb 2005
Location: Steam
Old 05-06-2006 , 23:47  
Reply With Quote #3

Thanx Man, I got the trails to work. Both the flashbang and smokegrenade, I got them to reload after battling with the script for about 30 minutes. Now gambit is awesome now


Here's the edited script of Gambit:
With Hegrenade, Flashbang, Smokegrenade (All were able to reload successfully)
Now three of the grenades have trails

Just want to share


#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

#define AMMOX_FLASHBANG 11
#define AMMOX_HEGRENADE 12
#define AMMOX_SMOKEGRENADE 13

// GLOBAL VARIABLES
new gHeroName[]="Gambit"
new bool:gHasGambitPower[SH_MAXSLOTS+1]
new gGrenTrail
new const HEGRENADE_MODEL[] = "models/w_hegrenade.mdl"
new const FLASHBANG_MODEL[] = "models/w_flashbang.mdl"
new const SMOKEGRENADE_MODEL[] = "models/w_smokegrenade.mdl"

//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Gambit", "version", "Authors Name")

// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("gambit_level", "0")
register_cvar("gambit_grenademult", "60.9")
register_cvar("gambit_grenadetimer", "30.0")
register_cvar("gambit_cooldown", "120.0")

// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "Kinetically Charged Nades", "Charge your HE Grenades with Kinetic Energy for Extra Damage, also refill HE Grenades.", false, "gambit_level")

// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
// INIT
register_srvcmd("gambit_init", "gambit_init")
shRegHeroInit(gHeroName, "gambit_init")

// NEW SPAWN
register_event("ResetHUD", "newSpawn", "b")

// EXTRA NADE DAMAGE
register_event("Damage", "gambit_damage", "b", "2!0")

// FIND THROWN GRENADES
register_event("AmmoX", "on_AmmoX", "b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
gGrenTrail = precache_model("sprites/zbeam5.spr")
}
//----------------------------------------------------------------------------------------------
public gambit_init()
{
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)

// 2nd Argument is 0 or 1 depending on whether the id has the hero
read_argv(2,temp,5)
new hasPowers = str_to_num(temp)

gHasGambitPower[id] = (hasPowers!=0)

if ( hasPowers && is_user_alive(id) ) {
gambit_weapons(id)
}
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
gPlayerUltimateUsed[id] = false
set_task(0.1, "gambit_weapons", id)
}
}
//----------------------------------------------------------------------------------------------
public gambit_weapons(id)
{
if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
shGiveWeapon(id, "weapon_hegrenade")
}


if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
shGiveWeapon(id, "weapon_flashbang")
}


if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
shGiveWeapon(id, "weapon_smokegrenade")
}
}
//----------------------------------------------------------------------------------------------
public gambit_damage(id)
{
if ( !shModActive() || !is_user_alive(id) ) return

new damage = read_data(2)
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
new headshot = bodypart == 1 ? 1 : 0

if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return

if ( gHasGambitPower[attacker] && weapon == CSW_HEGRENADE && is_user_alive(id) && !gPlayerUltimateUsed[attacker] ) {
// do extra damage
new extraDamage = floatround(damage * get_cvar_float("gambit_grenademult") - damage)
if (extraDamage > 0) shExtraDamage(id, attacker, extraDamage, "grenade", headshot)

if ( attacker != id ) {
// Set the cooldown in x seconds because nades can hurt more then one person
// only when damaging others
new parm[1]
parm[0] = attacker
set_task(0.2, "gambit_setcooldown", 0, parm,1)
}
}
}
//----------------------------------------------------------------------------------------------
public on_AmmoX(id)
{
if ( !shModActive() || !is_user_alive(id) ) return

new iAmmoType = read_data(1)
new iAmmoCount = read_data(2)

if ( iAmmoType == AMMOX_HEGRENADE && gHasGambitPower[id] ) {

if (iAmmoCount == 0) {
set_task(get_cvar_float("gambit_grenadetimer" ), "gambit_weapons", id)

if ( !gPlayerUltimateUsed[id] ) {
// Have to Find the current HE grenade
new iCurrent = -1
while ( ( iCurrent = FindEntity(iCurrent, "grenade") ) > 0 ) {
new string[32]
Entvars_Get_String(iCurrent, EV_SZ_model, string, 31)

if ( id == Entvars_Get_Edict(iCurrent, EV_ENT_owner) && equali(HEGRENADE_MODEL, string)) {

new Float:glowColor[3] = {225.0, 0.0, 20.0}

// Make the nade glow
Entvars_Set_Int(iCurrent, EV_INT_renderfx, kRenderFxGlowShell)
Entvars_Set_Vector(iCurrent, EV_VEC_rendercolor, glowColor)

// Make the nade a bit invisible to make glow look better
Entvars_Set_Int(iCurrent, EV_INT_rendermode, kRenderTransAlpha)
Entvars_Set_Float(iCurrent, EV_FL_renderamt, 100.0 )

// Make a trail
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
write_byte(22) //TE_BEAMFOLLOW
write_short(iCurrent) // entity:attachment to follow
write_short(gGrenTrail) // sprite index
write_byte(10) // life in 0.1's
write_byte(10) // line width in 0.1's
write_byte(225) // colour
write_byte(90)
write_byte(102)
write_byte(255) // brightness
message_end()
}
}
}
}
else if (iAmmoCount > 0) {
// Got a new nade remove the timer
remove_task(id)
}
}
if ( iAmmoType == AMMOX_FLASHBANG && gHasGambitPower[id] ) {

if (iAmmoCount == 0) {
set_task(get_cvar_float("gambit_grenadetimer" ), "gambit_weapons", id)

if ( !gPlayerUltimateUsed[id] ) {
// Have to Find the current HE grenade
new iCurrent = -1
while ( ( iCurrent = FindEntity(iCurrent, "grenade") ) > 0 ) {
new string[32]
Entvars_Get_String(iCurrent, EV_SZ_model, string, 31)

if ( id == Entvars_Get_Edict(iCurrent, EV_ENT_owner) && equali(FLASHBANG_MODEL, string)) {

new Float:glowColor[3] = {225.0, 0.0, 20.0}

// Make the nade glow
Entvars_Set_Int(iCurrent, EV_INT_renderfx, kRenderFxGlowShell)
Entvars_Set_Vector(iCurrent, EV_VEC_rendercolor, glowColor)

// Make the nade a bit invisible to make glow look better
Entvars_Set_Int(iCurrent, EV_INT_rendermode, kRenderTransAlpha)
Entvars_Set_Float(iCurrent, EV_FL_renderamt, 100.0 )

// Make a trail
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
write_byte(22) //TE_BEAMFOLLOW
write_short(iCurrent) // entity:attachment to follow
write_short(gGrenTrail) // sprite index
write_byte(10) // life in 0.1's
write_byte(10) // line width in 0.1's
write_byte(225) // colour
write_byte(90)
write_byte(102)
write_byte(255) // brightness
message_end()
}
}
}
}
else if (iAmmoCount > 0) {
// Got a new nade remove the timer
remove_task(id)
}
}
if ( iAmmoType == AMMOX_SMOKEGRENADE && gHasGambitPower[id] ) {

if (iAmmoCount == 0) {
set_task(get_cvar_float("gambit_grenadetimer" ), "gambit_weapons", id)

if ( !gPlayerUltimateUsed[id] ) {
// Have to Find the current HE grenade
new iCurrent = -1
while ( ( iCurrent = FindEntity(iCurrent, "grenade") ) > 0 ) {
new string[32]
Entvars_Get_String(iCurrent, EV_SZ_model, string, 31)

if ( id == Entvars_Get_Edict(iCurrent, EV_ENT_owner) && equali(SMOKEGRENADE_MODEL, string)) {

new Float:glowColor[3] = {225.0, 0.0, 20.0}

// Make the nade glow
Entvars_Set_Int(iCurrent, EV_INT_renderfx, kRenderFxGlowShell)
Entvars_Set_Vector(iCurrent, EV_VEC_rendercolor, glowColor)

// Make the nade a bit invisible to make glow look better
Entvars_Set_Int(iCurrent, EV_INT_rendermode, kRenderTransAlpha)
Entvars_Set_Float(iCurrent, EV_FL_renderamt, 100.0 )

// Make a trail
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
write_byte(22) //TE_BEAMFOLLOW
write_short(iCurrent) // entity:attachment to follow
write_short(gGrenTrail) // sprite index
write_byte(10) // life in 0.1's
write_byte(10) // line width in 0.1's
write_byte(225) // colour
write_byte(90)
write_byte(102)
write_byte(255) // brightness
message_end()
}
}
}
}
else if (iAmmoCount > 0) {
// Got a new nade remove the timer
remove_task(id)
}
}

}
//----------------------------------------------------------------------------------------------
public gambit_setcooldown(parm[])
{
new id = parm[0]

if ( !is_user_alive(id) || gPlayerUltimateUsed[id] ) return

// Cooldown will only be set if user hurts someone with a gambit nade
new Float:gambitCooldown = get_cvar_float("gambit_cooldown")
if (gambitCooldown > 0.0) ultimateTimer(id, gambitCooldown)
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gHasGambitPower[id] = false
}
//----------------------------------------------------------------------------------------------
__________________
CS is Love, CS is the source of Love. CS made me the person I am today, ^_º A little bit weird... rofl


[IMG]http://img14.**************/img14/3522/20526a.gif[/IMG]
Kenchi is offline
Send a message via MSN to Kenchi Send a message via Yahoo to Kenchi
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 13:29.


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