Raised This Month: $ Target: $400
 0% 

[REQ] Edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jingojang
Senior Member
Join Date: Feb 2010
Location: The Moon
Old 03-23-2015 , 08:04   [REQ] Edit
Reply With Quote #1

Hello,

I need help adding so that this plugin only flashes the Counter-Terrorists. The Terrorist should be immune to their own and other players flashbangs.

PHP Code:
#include <amxmodx>
#include <fakemeta>

new const Version[] = "1.0.1"

new MsgScreenFadeMsgScreenShake 
new FLenableFLcolorFLradiusFLlightcolorFLsound

new const Sound[] = "sound/ultrasound.mp3"

public plugin_precache() {
    
FLsound register_cvar("amx_rfl_sound""1")
    
    if(
get_pcvar_num(FLsound))
        
precache_generic(Sound)
}

public 
plugin_init()
{
    
register_plugin("Realistic FlashBang"Version"GlaDiuS")
    
    
FLenable register_cvar("amx_rfl_enable""1")
    
FLcolor register_cvar("amx_rfl_color""128 128 128")
    
FLradius register_cvar("amx_rfl_radius","50")
    
FLlightcolor register_cvar("amx_rfl_lightcolor","255 255 255")
    
    
register_event("ScreenFade","FlashEvent","b","4=255","5=255","6=255","7>199")
    
register_forward(FM_EmitSound,"fw_emitsound")
    
    
MsgScreenFade get_user_msgid("ScreenFade")
    
MsgScreenShake get_user_msgid("ScreenShake");
}

public 
FlashEvent(id)
{    
    if(!
get_pcvar_num(FLenable)) 
        return
    
    
// get color
    
new Colores[12], rgb[3][4], RedGreenBlue
    get_pcvar_string
(FLcolorColorescharsmax(Colores))
    
parse(Coloresrgb[0], 3rgb[1], 3rgb[2], 3)
    
Red clamp(str_to_num(rgb[0]), 0255)
    
Green clamp(str_to_num(rgb[1]), 0255)
    
Blue clamp(str_to_num(rgb[2]), 0255)
    
    new 
DurationHoldTimeFadeAlpha
    Duration 
read_data(1)
    
HoldTime read_data(2)
    
Fade read_data(3)
    
Alpha read_data(7)
    
    
message_begin(MSG_ONEMsgScreenFade, {0,0,0}, id)
    
write_short(Duration)    // Duration
    
write_short(HoldTime)    // Hold time
    
write_short(Fade)    // Fade type
    
write_byte(Red)        // Red
    
write_byte(Green)        // Green
    
write_byte(Blue)        // Blue
    
write_byte(Alpha)    // Alpha
    
message_end()
    
    
set_pev(idpev_punchangleFloat:{125.0125.0125.0})
    
    if(
get_pcvar_num(FLsound)) {
        
client_cmd(id"mp3 play %s"Sound)
        
set_task(8.0"stoppedsound"id)
    }
    
    
set_task(3.0"Shake"id)
}

public 
Shake(id)
{
    new 
Dura UTIL_FixedUnsigned16(4.0<< 12)
    new 
Freq UTIL_FixedUnsigned16(0.7 << 8)
    new 
Ampl UTIL_FixedUnsigned16(20.0<< 12)
    
    
message_begin(MSG_ONE MsgScreenShake , {0,0,0} ,id)
    
write_shortAmpl // --| Shake amount.
    
write_shortDura // --| Shake lasts this long.
    
write_shortFreq // --| Shake noise frequency.
    
message_end ()
}

public 
stoppedsound(id)
    
client_cmd(id"mp3 stop %s"Sound)

public 
fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
    if(!
get_pcvar_num(FLenable))
        return 
FMRES_IGNORED
    
    
// not a flashbang exploding
    
if(!equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav"))
        return 
FMRES_IGNORED
    
    
// light effect
    
flashbang_explode(entity)
    
    return 
FMRES_IGNORED
}

public 
flashbang_explode(greindex)
{
    if(!
pev_valid(greindex)) 
        return
    
    
// get origin of explosion
    
new Float:origin[3]
    
pev(greindexpev_originorigin)
    
    
// get color
    
new Colores[12], rgb[3][4], RedGreenBlue
    get_pcvar_string
(FLlightcolorColorescharsmax(Colores))
    
parse(Coloresrgb[0], 3rgb[1], 3rgb[2], 3)
    
Red clamp(str_to_num(rgb[0]), 0255)
    
Green clamp(str_to_num(rgb[1]), 0255)
    
Blue clamp(str_to_num(rgb[2]), 0255)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_DLIGHT// 27
    
write_coord(floatround(origin[0])) // x
    
write_coord(floatround(origin[1])) // y
    
write_coord(floatround(origin[2])) // z
    
write_byte(get_pcvar_num(FLradius)) // radius
    
write_byte(Red// Red
    
write_byte(Green// Green
    
write_byte(Blue// Blue
    
write_byte(8// life
    
write_byte(60// decay rate
    
message_end()
}

UTIL_FixedUnsigned16 ( const Float:Value, const Scale ) {
    return 
clampfloatroundValue Scale ), 00xFFFF );

Regards,
Jingo
__________________
jingojang is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 03-23-2015 , 14:30   Re: [REQ] Edit
Reply With Quote #2

Your code is using slowhacking
PHP Code:
client_cmd(id"mp3 play %s"Sound
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 03-23-2015 , 22:59   Re: [REQ] Edit
Reply With Quote #3

That's not slowhacking, it's just playing a sound on the client.
Obada is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 03-24-2015 , 02:09   Re: [REQ] Edit
Reply With Quote #4

@jingojang
I'm not guarantee if this work
PHP Code:
....
public 
FlashEvent(id)
{
     if(!
get_pcvar_num(FLenable))
          return
     if(
cs_get_user_team(id) == CS_TEAM_T)
          return 
PLUGIN_HANDLED
     
/////////stuff

@BaD CopY: this is not slowhacking, you can learn more about it here https://developer.valvesoftware.com/...in_Slowhacking
__________________

Last edited by Shiina.Mashiro; 03-24-2015 at 02:10.
Shiina.Mashiro is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 03-24-2015 , 06:55   Re: [REQ] Edit
Reply With Quote #5

sryy ://
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
jingojang
Senior Member
Join Date: Feb 2010
Location: The Moon
Old 03-26-2015 , 13:30   Re: [REQ] Edit
Reply With Quote #6

Quote:
Originally Posted by Shiina.Mashiro View Post
@jingojang
I'm not guarantee if this work
PHP Code:
....
public 
FlashEvent(id)
{
     if(!
get_pcvar_num(FLenable))
          return
     if(
cs_get_user_team(id) == CS_TEAM_T)
          return 
PLUGIN_HANDLED
     
/////////stuff

@BaD CopY: this is not slowhacking, you can learn more about it here https://developer.valvesoftware.com/...in_Slowhacking
Thanks for your respons,
But it tells me that FlashEvent should return a value.

Regards,
Jingo
__________________
jingojang is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 03-26-2015 , 13:45   Re: [REQ] Edit
Reply With Quote #7

Code:
return PLUGIN_HANDLED
-->
Code:
return

And you need to add the cstrike include or use this code instead that is built in amxmodx include

Code:
if(get_user_team(id) == 1)
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.

Last edited by ironskillz1; 03-26-2015 at 13:50.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
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 10:38.


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