Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Modyfikacja

Przerobienie head_splash

Modyfikacja

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
4 odpowiedzi w tym temacie

#1 Strike

    Życzliwy

  • Użytkownik

Reputacja: 5
Nowy

  • Postów:36
  • Imię:Michal
  • Lokalizacja:Kartuzy
Offline

Napisano 17.10.2011 18:52

Witam. Mam plugin head splash. Działa on tak, że gdy skoczę komuś na głowę to zabiera mu ileś hp jeśli stoję na nim to też mu zabiera, ale mniej. ( Jeszcze jak ktoś ma vesthelma to zabiera mniej )

Chciałbym mieć go tak przerobione by nieważne czy ktoś skoczył na kogoś czy stoi na nim czy ma vesta czy nie zabierało tyle samo hp ( 70 ) .

Myślę, że to nie jest takie trudne ( chodź dla mnie tak ). Polecą ++ z góry thx

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define PLUGIN_VERSION "1.4"
// JUMPING
#define MINIMUM_FALL_SPEED 300
#define MAXIMUM_DAMAGE_FROM_JUMP 70.0
//STANDING
#define DAMAGE 6.0
#define DELAY 0.5
new amx_headsplash;
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, "potatis_invalido"); // Register the plugin.
amx_headsplash = register_cvar("amx_headsplash", "1"); // Register the on/off cvar.
register_forward(FM_Touch, "forward_touch"); // Register the "touch" forward.
register_forward(FM_PlayerPreThink, "forward_PlayerPreThink"); // TY Alka!
}
public plugin_precache()
{
sprite_blood = precache_model("sprites/blood.spr");
sprite_bloodspray = precache_model("sprites/bloodspray.spr");
}
public forward_touch(toucher, touched) // This function is called every time a player touches another player.
{
// NOTE: The toucher is the player standing/falling on top of the other (touched) player's head.
if(!is_user_alive(toucher) || !is_user_alive(touched)) // The touching players can't be dead.
return;

if(!get_pcvar_num(amx_headsplash)) // If the plugin is disabled, stop messing with things.
return;

if(falling_speed[touched]) // Check if the touched player is falling. If he/she is, don't continue.
return;

if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire")) // If the touchers are in the same team and friendly fire is off, don't continue.
return;

new touched_origin[3], toucher_origin[3];
get_user_origin(touched, touched_origin); // Get the origins of the players so it's possible to check if the toucher is standing on the touched's head.
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 touche*_minsize is equal to -18.0, touche* is crouching.

if(touched_minsize[2] != -18.0) // If the touched player IS NOT crouching, check if the toucher is on his/her head.
{
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 the touched player is crouching, check if the toucher is on his/her head
{
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) // If the toucher is falling in the required speed or faster, then landing on top of the touched's head, do some damage to the touched. MUHAHAHAHAHA!!!
{
new Float:damage = ((falling_speed[toucher] - MINIMUM_FALL_SPEED + 30) * (falling_speed[toucher] - MINIMUM_FALL_SPEED + 30)) / 1300;
if(damage > MAXIMUM_DAMAGE_FROM_JUMP) // Make shure that the touched player don't take too much damage.
damage = MAXIMUM_DAMAGE_FROM_JUMP;
damage_player(touched, toucher, damage); // Damage or kill the touched player.
damage_after[toucher][touched] = 0.0; // Reset.
}
if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime()) // This makes shure that you won't get damaged every frame you have some one on your head. It also makes shure that players won't get damaged faster on fast servers than laggy servers.
{
damage_after[toucher][touched] = get_gametime() + DELAY;
damage_player(touched, toucher, DAMAGE); // Damage or kill the touched player.
}
}
public forward_PlayerPreThink(id) // This is called every time before a player "thinks". A player thinks many times per second.
{
//falling_speed[id] = entity_get_float(id, EV_FL_flFallVelocity); // Store the falling speed of the soon to be "thinking" player.
pev(id, pev_flFallVelocity, falling_speed[id])
}
public damage_player(pwned, pwnzor, Float:damage) // Damages or kills a player. Home made HAX
{
new health = get_user_health(pwned);
if(get_user_team(pwned) == get_user_team(pwnzor)) // If both players are in the same team, reduce the damage.
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); // BLOOOOOOOOOOOD!!
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); // BLOOOOOOOOOOOD!!
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 :)");
if(get_user_team(pwnzor) != get_user_team(pwned)) // If it was a team kill, the pwnzor's money should get reduced instead of increased.
{
set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) + 1));
cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) + 300);
}
else
{
set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) - 1));
cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) - 300);
}

message_begin(MSG_ALL, get_user_msgid("ScoreInfo")); // Fixes the scoreboard.
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));
}
}

  • +
  • -
  • 0

#2 oxygenium

    Pomocny

  • Zbanowany

Reputacja: 0
zer0.

  • Postów:64
  • Lokalizacja:Kraków
Offline

Napisano 17.10.2011 18:56

Pan spróbuje
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define PLUGIN_VERSION "1.4"
// JUMPING
#define MINIMUM_FALL_SPEED 300
#define MAXIMUM_DAMAGE_FROM_JUMP 70.0
//STANDING
#define DAMAGE 70.0
#define DELAY 0.5
new amx_headsplash;
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, "potatis_invalido"); // Register the plugin.
amx_headsplash = register_cvar("amx_headsplash", "1"); // Register the on/off cvar.
register_forward(FM_Touch, "forward_touch"); // Register the "touch" forward.
register_forward(FM_PlayerPreThink, "forward_PlayerPreThink"); // TY Alka!
}
public plugin_precache()
{
sprite_blood = precache_model("sprites/blood.spr");
sprite_bloodspray = precache_model("sprites/bloodspray.spr");
}
public forward_touch(toucher, touched) // This function is called every time a player touches another player.
{
// NOTE: The toucher is the player standing/falling on top of the other (touched) player's head.
if(!is_user_alive(toucher) || !is_user_alive(touched)) // The touching players can't be dead.
  return;
if(!get_pcvar_num(amx_headsplash)) // If the plugin is disabled, stop messing with things.
  return;
if(falling_speed[touched]) // Check if the touched player is falling. If he/she is, don't continue.
  return;
if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire")) // If the touchers are in the same team and friendly fire is off, don't continue.
  return;
new touched_origin[3], toucher_origin[3];
get_user_origin(touched, touched_origin); // Get the origins of the players so it's possible to check if the toucher is standing on the touched's head.
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 touche*_minsize is equal to -18.0, touche* is crouching.
if(touched_minsize[2] != -18.0) // If the touched player IS NOT crouching, check if the toucher is on his/her head.
{
  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 the touched player is crouching, check if the toucher is on his/her head
{
  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) // If the toucher is falling in the required speed or faster, then landing on top of the touched's head, do some damage to the touched. MUHAHAHAHAHA!!!
{
  new Float:damage = ((falling_speed[toucher] - MINIMUM_FALL_SPEED + 30) * (falling_speed[toucher] - MINIMUM_FALL_SPEED + 30)) / 1300;
  if(damage > MAXIMUM_DAMAGE_FROM_JUMP) // Make shure that the touched player don't take too much damage.
   damage = MAXIMUM_DAMAGE_FROM_JUMP;
  damage_player(touched, toucher, damage); // Damage or kill the touched player.
  damage_after[toucher][touched] = 0.0; // Reset.
}
if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime()) // This makes shure that you won't get damaged every frame you have some one on your head. It also makes shure that players won't get damaged faster on fast servers than laggy servers.
{
  damage_after[toucher][touched] = get_gametime() + DELAY;
  damage_player(touched, toucher, DAMAGE); // Damage or kill the touched player.
}
}
public forward_PlayerPreThink(id) // This is called every time before a player "thinks". A player thinks many times per second.
{
//falling_speed[id] = entity_get_float(id, EV_FL_flFallVelocity); // Store the falling speed of the soon to be "thinking" player.
pev(id, pev_flFallVelocity, falling_speed[id])
}
public damage_player(pwned, pwnzor, Float:damage) // Damages or kills a player. Home made HAX
{
new health = get_user_health(pwned);
if(get_user_team(pwned) == get_user_team(pwnzor)) // If both players are in the same team, reduce the damage.
  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); // BLOOOOOOOOOOOD!!
  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); // BLOOOOOOOOOOOD!!
  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 <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />");
  if(get_user_team(pwnzor) != get_user_team(pwned)) // If it was a team kill, the pwnzor's money should get reduced instead of increased.
  {
   set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) + 1));
   cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) + 300);
  }
  else
  {
   set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) - 1));
   cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) - 300);
  }
 
  message_begin(MSG_ALL, get_user_msgid("ScoreInfo")); // Fixes the scoreboard.
  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));
}
}

Użytkownik oxygenium edytował ten post 17.10.2011 18:57


#3 Strike

    Życzliwy

  • Autor tematu
  • Użytkownik

Reputacja: 5
Nowy

  • Postów:36
  • Imię:Michal
  • Lokalizacja:Kartuzy
Offline

Napisano 17.10.2011 21:13

Już stąd widzę, że nie bd działać tak jak chciałem jak ktoś ma vesta ..
  • +
  • -
  • 0

#4 mierzwi

    Banned

  • Zbanowany

Reputacja: 235
Wszechwidzący

  • Postów:651
  • Lokalizacja:Polska
Offline

Napisano 19.10.2011 00:19

w
public damage_player
usuń to
if(get_user_team(pwned) == get_user_team(pwnzor)) // If both players are in the same team, reduce the damage.
  damage /= 1.4;
new CsArmorType:armortype;
cs_get_user_armor(pwned, armortype);
if(armortype == CS_ARMOR_VESTHELM)
  damage *= 0.7;


albo po prostu zmień te 1.4 i 0.7 na 1.0
+
#define MINIMUM_FALL_SPEED 999999999 /* duza liczba zeby nigdy tak sie nie stalo <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' /> */
#define MAXIMUM_DAMAGE_FROM_JUMP 70.0
//STANDING
#define DAMAGE 70.0
#define DELAY 0.5 /* czas, co ile sec */



Użytkownik funfel edytował ten post 19.10.2011 00:22

jeśli masz fejsa i chcesz mi pomóc to wejdź tutaj: Zaproś kumpla by lubił nasz sklep | Facebook

na pewno jakoś C się odwdzięczę!


#5 Strike

    Życzliwy

  • Autor tematu
  • Użytkownik

Reputacja: 5
Nowy

  • Postów:36
  • Imię:Michal
  • Lokalizacja:Kartuzy
Offline

Napisano 19.10.2011 14:29

O dzięki, ale już wcześniej jakoś dziwacznie sobie sam zaradziłem :). + dla cb :)
Sam zobacz:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define PLUGIN_VERSION "1.4"
// JUMPING
//STANDING
#define DAMAGE 35.0
#define DELAY 1.2
new amx_headsplash;
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, "potatis_invalido"); // Register the plugin.
amx_headsplash = register_cvar("amx_headsplash", "1"); // Register the on/off cvar.
register_forward(FM_Touch, "forward_touch"); // Register the "touch" forward.
register_forward(FM_PlayerPreThink, "forward_PlayerPreThink"); // TY Alka!
}
public plugin_precache()
{
sprite_blood = precache_model("sprites/blood.spr");
sprite_bloodspray = precache_model("sprites/bloodspray.spr");
}
public forward_touch(toucher, touched) // This function is called every time a player touches another player.
{
// NOTE: The toucher is the player standing/falling on top of the other (touched) player's head.
if(!is_user_alive(toucher) || !is_user_alive(touched)) // The touching players can't be dead.
return;

if(!get_pcvar_num(amx_headsplash)) // If the plugin is disabled, stop messing with things.
return;

if(falling_speed[touched]) // Check if the touched player is falling. If he/she is, don't continue.
return;

if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire")) // If the touchers are in the same team and friendly fire is off, don't continue.
return;

new touched_origin[3], toucher_origin[3];
get_user_origin(touched, touched_origin); // Get the origins of the players so it's possible to check if the toucher is standing on the touched's head.
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 touche*_minsize is equal to -18.0, touche* is crouching.

if(touched_minsize[2] != -18.0) // If the touched player IS NOT crouching, check if the toucher is on his/her head.
{
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 the touched player is crouching, check if the toucher is on his/her head
{
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]) // If the toucher is falling in the required speed or faster, then landing on top of the touched's head, do some damage to the touched. MUHAHAHAHAHA!!!
{
new Float:damage = 35.0;
damage_player(touched, toucher, damage); // Damage or kill the touched player.
damage_after[toucher][touched] = 0.0; // Reset.
}
if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime()) // This makes shure that you won't get damaged every frame you have some one on your head. It also makes shure that players won't get damaged faster on fast servers than laggy servers.
{
damage_after[toucher][touched] = get_gametime() + DELAY;
damage_player(touched, toucher, DAMAGE); // Damage or kill the touched player.
}
}
public forward_PlayerPreThink(id) // This is called every time before a player "thinks". A player thinks many times per second.
{
//falling_speed[id] = entity_get_float(id, EV_FL_flFallVelocity); // Store the falling speed of the soon to be "thinking" player.
pev(id, pev_flFallVelocity, falling_speed[id])
}
public damage_player(pwned, pwnzor, Float:damage) // Damages or kills a player. Home made HAX
{
new health = get_user_health(pwned);
if(get_user_team(pwned) == get_user_team(pwnzor)) // If both players are in the same team, reduce the damage.
damage /= 2.0;
if(health > damage)
{
new pwned_origin[3];
get_user_origin(pwned, pwned_origin);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY); // BLOOOOOOOOOOOD!!
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); // BLOOOOOOOOOOOD!!
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 :)");
if(get_user_team(pwnzor) != get_user_team(pwned)) // If it was a team kill, the pwnzor's money should get reduced instead of increased.
{
set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) + 1));
cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) + 300);
}
else
{
set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) - 1));
cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) - 300);
}

message_begin(MSG_ALL, get_user_msgid("ScoreInfo")); // Fixes the scoreboard.
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));
}
}

  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: Modyfikacja

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych