Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <fakemeta>
- #include <cstrike>
- #define PLUGIN_VERSION "1.4"
- #define MINIMUM_FALL_SPEED 300
- #define MAXIMUM_DAMAGE_FROM_JUMP 70.0
- #define DAMAGE 10.0
- #define DELAY 2.0
- new Float:falling_speed[33];
- new Float:damage_after[33][33];
- new sprite_blood;
- new sprite_bloodspray;
- public plugin_init()
- {
- register_plugin("Head Splash", PLUGIN_VERSION, "Someones..");
- register_forward(FM_Touch, "forward_touch");
- register_forward(FM_PlayerPreThink, "forward_PlayerPreThink");
- }
- public plugin_precache()
- {
- sprite_blood = precache_model("sprites/blood.spr");
- sprite_bloodspray = precache_model("sprites/bloodspray.spr");
- }
- public forward_touch(toucher, touched)
- {
- if(!is_user_alive(toucher) || !is_user_alive(touched))
- return;
- if(falling_speed[touched])
- return;
- if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire"))
- return;
- new touched_origin[3], toucher_origin[3];
- get_user_origin(touched, touched_origin);
- get_user_origin(toucher, toucher_origin);
- new Float:toucher_minsize[3], Float:touched_minsize[3];
- pev(toucher,pev_mins,toucher_minsize);
- pev(touched,pev_mins,touched_minsize);
- if(touched_minsize[2] != -18.0)
- {
- if(!(toucher_origin[2] == touched_origin[2]+72 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+54 && toucher_minsize[2] == -18.0))
- {
- return;
- }
- }
- else
- {
- if(!(toucher_origin[2] == touched_origin[2]+68 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+50 && toucher_minsize[2] == -18.0))
- {
- return;
- }
- }
- if(falling_speed[toucher] >= MINIMUM_FALL_SPEED)
- {
- new Float:damage = ((falling_speed[toucher] - MINIMUM_FALL_SPEED + 30) * (falling_speed[toucher] - MINIMUM_FALL_SPEED + 30)) / 1300;
- if(damage > MAXIMUM_DAMAGE_FROM_JUMP)
- damage = MAXIMUM_DAMAGE_FROM_JUMP;
- damage_player(touched, toucher, damage);
- damage_after[toucher][touched] = 0.0;
- }
- if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime())
- {
- damage_after[toucher][touched] = get_gametime() + DELAY;
- damage_player(touched, toucher, DAMAGE);
- }
- }
- public forward_PlayerPreThink(id)
- {
- pev(id, pev_flFallVelocity, falling_speed[id])
- }
- public damage_player(pwned, pwnzor, Float:damage)
- {
- new health = get_user_health(pwned);
- if(get_user_team(pwned) == get_user_team(pwnzor))
- damage /= 1.4;
- new CsArmorType:armortype;
- cs_get_user_armor(pwned, armortype);
- if(armortype == CS_ARMOR_VESTHELM)
- damage *= 0.7;
- if(health > damage)
- {
- new pwned_origin[3];
- get_user_origin(pwned, pwned_origin);
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BLOODSPRITE);
- write_coord(pwned_origin[0]+8);
- write_coord(pwned_origin[1]);
- write_coord(pwned_origin[2]+26);
- write_short(sprite_bloodspray);
- write_short(sprite_blood);
- write_byte(248);
- write_byte(4);
- message_end();
- new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "trigger_hurt"));
- if(!ent)
- return;
- new value[16];
- float_to_str(damage * 2, value, sizeof value - 1);
- set_kvd(0, KV_ClassName, "trigger_hurt");
- set_kvd(0, KV_KeyName, "dmg");
- set_kvd(0, KV_Value, value);
- set_kvd(0, KV_fHandled, 0);
- dllfunc(DLLFunc_KeyValue, ent, 0);
- num_to_str(DMG_GENERIC, value, sizeof value - 1);
- set_kvd(0, KV_ClassName, "trigger_hurt");
- set_kvd(0, KV_KeyName, "damagetype");
- set_kvd(0, KV_Value, value);
- set_kvd(0, KV_fHandled, 0);
- dllfunc(DLLFunc_KeyValue, ent, 0);
- set_kvd(0, KV_ClassName, "trigger_hurt");
- set_kvd(0, KV_KeyName, "origin");
- set_kvd(0, KV_Value, "8192 8192 8192");
- set_kvd(0, KV_fHandled, 0);
- dllfunc(DLLFunc_KeyValue, ent, 0);
- dllfunc(DLLFunc_Spawn, ent);
- set_pev(ent, pev_classname, "head_splash");
- dllfunc(DLLFunc_Touch, ent, pwned);
- engfunc(EngFunc_RemoveEntity, ent);
- }
- else
- {
- new pwned_origin[3];
- get_user_origin(pwned, pwned_origin);
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BLOODSPRITE);
- write_coord(pwned_origin[0]+8);
- write_coord(pwned_origin[1]);
- write_coord(pwned_origin[2]+26);
- write_short(sprite_bloodspray);
- write_short(sprite_blood);
- write_byte(248);
- write_byte(12);
- message_end();
- set_pev(pwned, pev_frags, float(get_user_frags(pwned) + 1));
- user_silentkill(pwned);
- make_deathmsg(pwnzor, pwned, 1, "his/her feet :)");
- message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
- write_byte(pwnzor);
- write_short(get_user_frags(pwnzor));
- write_short(cs_get_user_deaths(pwnzor));
- write_short(0);
- write_short(get_user_team(pwnzor));
- message_end();
- message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
- write_byte(pwned);
- write_short(get_user_frags(pwned));
- write_short(cs_get_user_deaths(pwned));
- write_short(0);
- write_short(get_user_team(pwned));
- message_end();
- set_pev(pwned, pev_frags, float(get_user_frags(pwned) - 1));
- }
- }
- /*************
- *** STOCKS ***
- *************/
- stock ColorMessage(const id, const input[], any:...){
- new count = 1, players[32];
- static msg[ 191 ];
- vformat(msg, 190, input, 3);
- if (id) players[0] = id; else get_players(players , count , "ch"); {
- for (new i = 0; i < count; i++){
- if (is_user_connected(players[i])){
- message_begin(MSG_ONE_UNRELIABLE , get_user_msgid("SayText"), _, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();}}}
- }
- stock hnsxp_add_user_xp(client, xp)
- {
- return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) + xp);
- }
- stock hnsxp_decrease_user_xp(client, xp)
- {
- return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) - xp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement