This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

lightning on kill plugin modification


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
frenetico9
Junior Member
Join Date: Feb 2021
Old 02-11-2021 , 22:19   lightning on kill plugin modification
Reply With Quote #1

I wanted to make the lightning on kill plugin work for players who die only under the knife

#include <amxmodx>
#include <fun>

new const g_szSound[] = "ambience/thunder_clap.wav"
new g_iLightning, g_iSmoke

public plugin_init()
{
register_plugin("Lightning on Kill", "1.0", "OciXCrom @ amxx-bg.info")
register_event("DeathMsg", "OnPlayerKilled", "a")
}

public plugin_precache()
{
precache_sound(g_szSound)
g_iLightning = precache_model("sprites/lgtning.spr")
g_iSmoke = precache_model("sprites/steam1.spr")
}

public OnPlayerKilled()
{
new iAttacker = read_data(1),
iVictim = read_data(2)

if(is_user_connected(iAttacker) && iAttacker != iVictim)
StruckLightning(iVictim)
}

StruckLightning(id)
{
new iOrigin[2][3]
get_user_origin(id, iOrigin[0])
iOrigin[0][2] = iOrigin[0][2] - 26
iOrigin[1][0] = iOrigin[0][0] + 150
iOrigin[1][1] = iOrigin[0][1] + 150
iOrigin[1][2] = iOrigin[0][2] + 400

emit_sound(id, CHAN_AUTO, g_szSound, 1.0, ATTN_NORM, 0, PITCH_NORM)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(0)
write_coord(iOrigin[0][0])
write_coord(iOrigin[0][1])
write_coord(iOrigin[0][2])
write_coord(iOrigin[1][0])
write_coord(iOrigin[1][1])
write_coord(iOrigin[1][2])
write_short(g_iLightning)
write_byte(1)
write_byte(5)
write_byte(2)
write_byte(100)
write_byte(30)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(200)
write_byte(200)
message_end()

message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin[1])
write_byte(9)
write_coord(iOrigin[1][0])
write_coord(iOrigin[1][1])
write_coord(iOrigin[1][2])
message_end()

message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iOrigin[1])
write_byte(5)
write_coord(iOrigin[1][0])
write_coord(iOrigin[1][1])
write_coord(iOrigin[1][2])
write_short(g_iSmoke)
write_byte(10)
write_byte(10)
message_end()
}
frenetico9 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-11-2021 , 22:36   Re: lightning on kill plugin modification
Reply With Quote #2

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

new const g_szSound[] = "ambience/thunder_clap.wav"
new g_iLightningg_iSmoke

 
public plugin_init()
{
    
register_plugin("Lightning on Kill""1.0""OciXCrom @ amxx-bg.info")
    
register_event("DeathMsg""OnPlayerKilled""4=knife")
}

public 
plugin_precache()
{
    
precache_sound(g_szSound)
    
g_iLightning precache_model("sprites/lgtning.spr")
    
g_iSmoke precache_model("sprites/steam1.spr")
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1),
    
iVictim read_data(2)

    if(
is_user_connected(iAttacker) && iAttacker != iVictim)
        
StruckLightning(iVictim)
}

StruckLightning(id)
{
    new 
iOrigin[2][3]
    
get_user_origin(idiOrigin[0])
    
iOrigin[0][2] = iOrigin[0][2] - 26
    iOrigin
[1][0] = iOrigin[0][0] + 150
    iOrigin
[1][1] = iOrigin[0][1] + 150
    iOrigin
[1][2] = iOrigin[0][2] + 400

    emit_sound
(idCHAN_AUTOg_szSound1.0ATTN_NORM0PITCH_NORM)

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(0)
    
write_coord(iOrigin[0][0])
    
write_coord(iOrigin[0][1])
    
write_coord(iOrigin[0][2])
    
write_coord(iOrigin[1][0])
    
write_coord(iOrigin[1][1])
    
write_coord(iOrigin[1][2])
    
write_short(g_iLightning)
    
write_byte(1)
    
write_byte(5)
    
write_byte(2)
    
write_byte(100)
    
write_byte(30)
    
write_byte(255)
    
write_byte(255)
    
write_byte(255)
    
write_byte(200)
    
write_byte(200)
    
message_end()

    
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin[1])
    
write_byte(9)
    
write_coord(iOrigin[1][0])
    
write_coord(iOrigin[1][1])
    
write_coord(iOrigin[1][2])
    
message_end()

    
message_begin(MSG_BROADCASTSVC_TEMPENTITYiOrigin[1])
    
write_byte(5)
    
write_coord(iOrigin[1][0])
    
write_coord(iOrigin[1][1])
    
write_coord(iOrigin[1][2])
    
write_short(g_iSmoke)
    
write_byte(10)
    
write_byte(10)
    
message_end()

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
frenetico9
Junior Member
Join Date: Feb 2021
Old 02-12-2021 , 01:40   Re: lightning on kill plugin modification
Reply With Quote #3

Thaaaaaanks <3
frenetico9 is offline
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 22:35.


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