AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Could someone recode this .sma file (https://forums.alliedmods.net/showthread.php?t=60517)

Pnoibestylin 09-05-2007 16:46

Could someone recode this .sma file
 
/********************************************* ***
One Hit Knife Kills
Author: Rabid Baboon
Version: 1.3
Mod: Counter-Strike
Requires: AMX mod X v1.01
Required Modules: cstrike, fakemeta engine and csx
Description:
Kills a player in one hit from the knife.

Special Thanks:
FireStorm - For the sucide message block function.

Changelog:
v1.3
Fixed getting knife kills when another player takes fall damage.
v1.2
Blocked sucide message from knife kills.
v1.1
Self-kill from fall damage while knife is out fixed.
********************************************* ***/
#include <amxmodx>
#include <cstrike>
#include <csx>
#include <fakemeta>
#include <engine>
#include <engine_stocks>
#include <fun>
/********************************************* ***
Global Variables
********************************************* ***/
new knifekill = 0
/********************************************* ***
Main Functions
********************************************* ***/
/********************************************* ***
plugin_modules()
Required modules listed here. Plugin will not work if they are not loaded.
********************************************* ***/
public plugin_modules()
{
require_module("cstrike");
require_module("csx");
require_module("fakemeta");
require_module("engine");
}
/********************************************* ***
plugin_init()
Initializes the plugin.
********************************************* ***/
public plugin_init()
{
register_plugin("One Hit Knife Kills", "1.3", "Rabid Baboon")
register_forward(FM_AlertMessage,"blocksuicid e")

return PLUGIN_HANDLED
}
/********************************************* ***
client_damage(attacker, victim, damage, wpnindex, hitplace, TA)
Kills a player if he was damaged by a knife.
Called when a player takes damage
********************************************* ***/
public client_damage(attacker, victim, damage, wpnindex, hitplace, TA)
{
if(is_user_alive(victim))
{
if((attacker != victim)) //prevents killing self with knife from fall damage.
{
if(wpnindex == CSW_KNIFE && TA != 1)
{
if(damage != DMG_FALL)
{
knifekill = 1
if(hitplace == HIT_HEAD)
{
make_deathmsg(attacker, victim, 1, "knife")
}
else
{
make_deathmsg(attacker, victim, 0, "knife")
}
user_silentkill(victim)
set_user_frags(attacker, get_user_frags(attacker)+1)
}
}
}
}

return PLUGIN_HANDLED
}
/********************************************* ***
blocksuicide(at_type, message[])
Blocks the sucide message caused user_silentkill
********************************************* ***/
public blocksuicide(at_type, message[])
{
if(containi(message,"suicide") > -1 && containi(message,"world") > -1 && knifekill == 1)
{
knifekill = 0
return FMRES_SUPERCEDE
}
return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

















could someone recode that for admin only?

vl@d 09-05-2007 17:28

Re: Could someone recode this .sma file
 
you know if you take them from behind they will be dead. 193 dmg :P

Arkshine 09-05-2007 17:39

Re: Could someone recode this .sma file
 
Try this :

Code:
    #include <amxmodx>     #include <fakemeta>     #define ADMIN_LEVEL ADMIN_IMMUNITY         new knifekill = 0;     public plugin_init()     {         register_plugin( "One Hit Knife Kills", "1.3", "Rabid Baboon" );         register_forward( FM_AlertMessage, "blocksuicide" );     }     public client_damage( attacker, victim, damage, wpnindex, hitplace, TA )     {         if( is_user_alive( victim ) )             return;                     if( attacker == victim )             return;         if( !( get_user_flags( attacker ) & ADMIN_LEVEL ) )             return;                     if( wpnindex == CSW_KNIFE && TA != 1)         {             if( damage != DMG_FALL )             {                 knifekill = 1;                                         if( hitplace == HIT_HEAD )                     make_deathmsg( attacker, victim, 1, "knife" );                 else                     make_deathmsg( attacker, victim, 0, "knife" );                                         user_silentkill( victim );                 set_pev( attacker, pev( attacker, pev_frags ) + 1 );             }         }     }     public blocksuicide( at_type, message[] )     {         if( containi( message ,"suicide" ) > -1 && containi( message, "world" ) > -1 && knifekill == 1 )         {             knifekill = 0;             return FMRES_SUPERCEDE;         }         return FMRES_IGNORED;     }

Pnoibestylin 09-06-2007 03:39

Re: Could someone recode this .sma file
 
Quote:

Originally Posted by arkshine (Post 527664)
Try this :

Code:
#include <amxmodx> #include <fakemeta> #define ADMIN_LEVEL ADMIN_IMMUNITY new knifekill = 0; public plugin_init() { register_plugin( "One Hit Knife Kills", "1.3", "Rabid Baboon" ); register_forward( FM_AlertMessage, "blocksuicide" ); } public client_damage( attacker, victim, damage, wpnindex, hitplace, TA ) { if( is_user_alive( victim ) ) return; if( attacker == victim ) return; if( !( get_user_flags( attacker ) & ADMIN_LEVEL ) ) return; if( wpnindex == CSW_KNIFE && TA != 1) { if( damage != DMG_FALL ) { knifekill = 1; if( hitplace == HIT_HEAD ) make_deathmsg( attacker, victim, 1, "knife" ); else make_deathmsg( attacker, victim, 0, "knife" ); user_silentkill( victim ); set_pev( attacker, pev( attacker, pev_frags ) + 1 ); } } } public blocksuicide( at_type, message[] ) { if( containi( message ,"suicide" ) > -1 && containi( message, "world" ) > -1 && knifekill == 1 ) { knifekill = 0; return FMRES_SUPERCEDE; } return FMRES_IGNORED; }

oh wow! it compiled succesfully. thank you very much.:up:
buh ahm. how much damage does it do ?
and wat admin_level u need to have to get to use this?

Arkshine 09-06-2007 06:51

Re: Could someone recode this .sma file
 
Quote:

could someone recode that for admin only?

#define ADMIN_LEVEL ADMIN_IMMUNITY


Change ADMIN_IMMUNITY by what you want. http://www.amxmodx.org/funcwiki.php?...=1#const_admin

Quote:

how much damage does it do ?
What? oO . This plugin doesn't deal with damage... You hit one time and the player will be kill...

purple_pixie 09-06-2007 09:01

Re: Could someone recode this .sma file
 
Also, if you replace:
Code:
        if( !( get_user_flags( attacker ) & ADMIN_LEVEL ) )             return;
with:
Code:
        if( !( get_user_flags( attacker ) & ADMIN_LEVEL ) )             return;         if( ( get_user_flags( victim) & ADMIN_LEVEL ) )             return;
then admins will be immune to the one hit kill.

Pnoibestylin 09-07-2007 17:32

Re: Could someone recode this .sma file
 
wait ahm. whats with the double kills?
everytime i kill someone with a knife.
it alwys said i killed him/her twice?
and the one knife kill doesnt work at all..
can someone recode this into a right way?
or maybe im doing somthing wrong.
and im using Purple_pixie's edited one...

fxfighter 09-07-2007 17:44

Re: Could someone recode this .sma file
 
shuld work instant kill whit knife exept admins
but will be random hs on the death msg dont know how to
get hs -.-

Code:


/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
public plugin_init() {
register_plugin("", "", "")
register_event("Damage","event_damage","be")
}
public event_damage(id)
{
new gun, attacker = get_user_attacker(id,gun)
if (is_user_alive(id) && !is_user_admin(id) && gun == CSW_KNIFE)
{
new score2 = get_user_frags(attacker)
new score = get_user_frags(id)
set_user_frags(id, score+1)
set_user_frags(attacker, score2+1)
set_user_health(id, 0)
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0)
write_byte(attacker)
write_byte(id)
write_byte(random_num(0,1))
write_string("KNIFE")
message_end()
}
return
}


Pnoibestylin 09-07-2007 18:06

Re: Could someone recode this .sma file
 
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/textIMbPtx.sma(18) : error 017: undefined symbol "BLOC"
/home/groups/amxmodx/tmp3/textIMbPtx.sma(18) : error 017: undefined symbol "K_ONCE"

ahm. yea.

Arkshine 09-07-2007 19:47

Re: Could someone recode this .sma file
 
@ Pnoibestylin : It doesn't work what I've done ?


All times are GMT -4. The time now is 16:05.

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