Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
05-08-2023
, 19:24
Re: Request plugin death effect
#5
Quote:
Originally Posted by
jerkofici
Hello everybody !!
Sorry for taking from your time but I am looking for a plugin for cs 1.6 server (amx vers 1.9) that looks like this :
Soul / spirit leave body when player get killed .
https://vm.tiktok.com/ZGJuJEyoR/
I do not want to make advertising or something but i saw this on TikTok and I did not find the plugin .
Do somebody can help me with a source code / model / plugin ?
Thanks a lot !
I tried to recreate what was seen in the video, this was the closest I could get it
First way, its behavior is the same but with another simpler methodology
PHP Code:
#include <amxmodx> #include <hamsandwich> #include <engine> #define PLUGIN "Player Soul" #define VERSION "1.3" #define AUTHOR "mlibre" new g_soulSpr , g_iCvarScreenFade , g_iCvarFloatHeight public plugin_precache () { register_plugin ( PLUGIN , VERSION , AUTHOR ) g_iCvarScreenFade = register_cvar ( "amx_psoul_screenfade" , "1" ) g_iCvarFloatHeight = register_cvar ( "amx_psoul_floatheight" , "180" ) g_soulSpr = precache_model ( "sprites/iplayerdead.spr" ) RegisterHam ( Ham_Killed , "player" , "Ham_KilledPlayer_Post" , 1 ) } public Ham_KilledPlayer_Post ( id , attacker ) { //green effects if( get_pcvar_num ( g_iCvarScreenFade )) { set_ScreenFade ( attacker ) } //generate the soul new Float : fOrigin [ 3 ]; entity_get_vector ( id , EV_VEC_origin , fOrigin ) message_begin ( MSG_BROADCAST , SVC_TEMPENTITY ) write_byte ( TE_BUBBLES ) #if !defined write_coord_f write_coord ( floatround ( fOrigin [ 0 ])) write_coord ( floatround ( fOrigin [ 1 ])) write_coord ( floatround ( fOrigin [ 2 ])) //min start position write_coord ( floatround ( fOrigin [ 0 ])) write_coord ( floatround ( fOrigin [ 1 ])) write_coord ( floatround ( fOrigin [ 2 ])+ 10 ) //max start position #else write_coord_f ( fOrigin [ 0 ]) write_coord_f ( fOrigin [ 1 ]) write_coord_f ( fOrigin [ 2 ]) //min start position write_coord_f ( fOrigin [ 0 ]) write_coord_f ( fOrigin [ 1 ]) write_coord_f ( fOrigin [ 2 ]+ 10 ) //max start position #endif write_coord ( get_pcvar_num ( g_iCvarFloatHeight )) //float height write_short ( g_soulSpr ) write_byte ( 1 ) //count write_coord ( 1 ) //speed message_end () } stock set_ScreenFade ( id ) { static maxplayers if( ! maxplayers ) maxplayers = get_maxplayers () #define isPlayer(%1) (1 <= %1 <= maxplayers) if( ! isPlayer ( id ) ) return static msgid_ScreenFade if( ! msgid_ScreenFade ) msgid_ScreenFade = get_user_msgid ( "ScreenFade" ) message_begin ( MSG_ONE_UNRELIABLE , msgid_ScreenFade , { 0 , 0 , 0 }, id ) write_short ( 1 << 10 ) // Duration write_short ( 1 << 10 ) // Hold time write_short ( 0x0000 ) // Fade type write_byte ( 120 ) // Red write_byte ( 255 ) // Green write_byte ( 120 ) // Blue write_byte ( 100 ) // Alpha message_end () }
changelog 1.x
1.3
added define isPlayer in "ScreenFade"
1.2
added suicide check "ScreenFade"
added extended support >182 "write_coord_f"
changed MSG_BROADCAST -> MSG_ONE_UNRELIABLE
1.1
1.0
The second way is the one that fits the most, as you can see I did not use a sprite but the same player models that do not require precaching
PHP Code:
#include <amxmodx> #include <hamsandwich> #include <engine> #define PLUGIN "Player Soul" #define VERSION "2.3" #define AUTHOR "mlibre" new g_iCvarScreenFade , g_fCvarTransparency , g_fCvarVelocity public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) g_iCvarScreenFade = register_cvar ( "amx_psoul_screenfade" , "1" ) g_fCvarTransparency = register_cvar ( "amx_psoul_transparency" , "50.0" ) g_fCvarVelocity = register_cvar ( "amx_psoul_velocity" , "80.0" ) RegisterHam ( Ham_Killed , "player" , "Ham_KilledPlayer_Post" , 1 ) } public Ham_KilledPlayer_Post ( id , attacker ) { //green effects if( get_pcvar_num ( g_iCvarScreenFade )) { set_ScreenFade ( attacker ) } //generate the soul new ent = create_entity ( "info_target" ) if( ! ent ) return entity_set_string ( ent , EV_SZ_classname , "s0ul" ) entity_set_int ( ent , EV_INT_movetype , MOVETYPE_NOCLIP ) entity_set_int ( ent , EV_INT_solid , SOLID_NOT ) new szInfo [ 64 ]; get_user_info ( id , "model" , szInfo , charsmax ( szInfo )) new szModel [ 256 ]; formatex ( szModel , charsmax ( szModel ), "models/player/%s/%s.mdl" , szInfo , szInfo ) //antiCrash! if( szModel [ strlen ( szModel ) - 4 ] == '.' && szModel [ strlen ( szModel ) - 3 ] == 'm' && szModel [ strlen ( szModel ) - 2 ] == 'd' && szModel [ strlen ( szModel ) - 1 ] == 'l' ) { entity_set_model ( ent , szModel ) } else { log_amx ( "%s *** overflow!" , szModel ) entity_set_model ( ent , "models/player.mdl" ) } entity_set_int ( ent , EV_INT_sequence , 64 ) // set player body =--()--= entity_set_float ( ent , EV_FL_frame , 0.0 ) new Float : fOrigin [ 3 ]; entity_get_vector ( id , EV_VEC_origin , fOrigin ) fOrigin [ 2 ] += 10.0 entity_set_origin ( ent , fOrigin ) // effect soul entity_set_int ( ent , EV_INT_renderfx , kRenderFxGlowShell ) entity_set_int ( ent , EV_INT_rendermode , kRenderTransAlpha ) entity_set_float ( ent , EV_FL_renderamt , get_pcvar_float ( g_fCvarTransparency )) // apply motion new Float : fVelocity [ 3 ] fVelocity [ 2 ] = get_pcvar_float ( g_fCvarVelocity ) entity_set_vector ( ent , EV_VEC_velocity , fVelocity ) set_task ( 3.0 , "remove_s0ul" , ent ) } public remove_s0ul ( ent ) { if( is_valid_ent ( ent )) entity_set_int ( ent , EV_INT_flags , FL_KILLME ) } stock set_ScreenFade ( id ) { static maxplayers if( ! maxplayers ) maxplayers = get_maxplayers () #define isPlayer(%1) (1 <= %1 <= maxplayers) if( ! isPlayer ( id ) ) return static msgid_ScreenFade if( ! msgid_ScreenFade ) msgid_ScreenFade = get_user_msgid ( "ScreenFade" ) message_begin ( MSG_ONE_UNRELIABLE , msgid_ScreenFade , { 0 , 0 , 0 }, id ) write_short ( 1 << 10 ) // Duration write_short ( 1 << 10 ) // Hold time write_short ( 0x0000 ) // Fade type write_byte ( 120 ) // Red write_byte ( 255 ) // Green write_byte ( 120 ) // Blue write_byte ( 100 ) // Alpha message_end () }
changelog 2.x
2.3
2.2
replace remove_entity -> FL_KILLME
added define isPlayer in "ScreenFade"
2.1
added containi check ".mdl" antiCrash!
added cvars
added suicide check "ScreenFade"
changed id ? MSG_ONE : MSG_ALL -> MSG_ONE_UNRELIABLE
2.0
__________________
Last edited by mlibre; 03-02-2024 at 09:50 .
Reason: releases 1.3&2.3