PDA

View Full Version : Can anyone tell me if this is for dod


blobby
06-22-2007, 05:21 PM
Hello guys/girls

I was just browsing some forums and i wounder if anyone could tell me if this will work with dod here is the whole code from the sma file:-


/* AMX Mod script.

AMX FirstBlood Plugin

(c) Copyright 2002-2003, Sonic 'sonic@codet.de'
This file is provided as is (no warranties).
*/

/* Put this in server.cfg or listenserver.cfg or amx.cfg:

amx_fb_mode <flags>
"a" - show firstblood msg in hud (everyone)
"b" - show firstblood msg in hud (for attacker only)
"ab"- do not display in hud at all ("a" & "b" are mutual exclusive)
"c" - show firstblood msg in chat (everyone)
"d" - play firstblood sound (for attacker only). Requires misc/firstblood.wav
"e" - set firstblood msg to damage_event (default death_event),
i.e. trigger real first blood (FirstHit)

Set amx_fb_mode "" to disable fistblood plugin.
Default amx_fb_mode value is "ad".
*/

/* History:

0.9.10 [2006/10/30] by Simon Logic (ICQ: 134190956)
+ sound precaching enabled, so you need to put firstblood.wav to server
only for convenient way of its distribution

0.9.9 [2006/10/14] by Simon Logic (ICQ: 134190956)
+ support for HL:DM
+ support for CS:DM
* more UT like style
* fixes
* code reorganization

0.9.3 [?] by Sonic
* release
*/

#include <amxmod>
#include <amxmisc> // is_running()

#define FB_PLUGIN_NAME "FirstBlood"
#define FB_PLUGIN_VERSION "0.9.10"
#define FB_PLUGIN_AUTHOR "Sonic"

#define FB_FLAG_HUD_E (1<<0)
#define FB_FLAG_HUD_A (1<<1)
#define FB_FLAG_NO_HUD (FB_FLAG_HUD_E|FB_FLAG_HUD_A)
#define FB_FLAG_CHAT (1<<2)
#define FB_FLAG_SND (1<<3)
#define FB_FLAG_FH (1<<4)

//#define FB_DEBUG

new bool:g_bUnderCS // flag: amxmod is running under CS or CZ
//-----------------------------------------------------------------------------
public plugin_init()
{
g_bUnderCS = (is_running("cstrike") || is_running("czero"))

// e-mail is removed cause the line looks too long when exec "amx plugins"
register_plugin(FB_PLUGIN_NAME, FB_PLUGIN_VERSION, FB_PLUGIN_AUTHOR)

if(g_bUnderCS) {
// NOTE: mp_roundtime can not be less than 1 minute
register_event("RoundTime", "onRoundTimer", "bc", "1>59")
// alternative way:
// register_logevent("onRoundRestart", 2, "0=World triggered", "1=Round_Start")
}

register_event("DeathMsg", "death_msg", "a")
register_event("Damage", "damage_msg", "b", "2!0", "4!0") // 2nd & 4th param <> 0
register_cvar("amx_fb_mode","ad")

// pause functions (b-flag)...
pause("b", "death_msg")
pause("b", "damage_msg")

server_print("[AMX] FirstBlood plugin initialized for %s mod", g_bUnderCS ? "CS": "HLDM")

return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public plugin_cfg()
{
if(!g_bUnderCS) switchEvent()

return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public plugin_precache()
{
if(file_exists("sound/misc/firstblood.wav"))
precache_sound("misc/firstblood.wav")
}
//-----------------------------------------------------------------------------
public onRoundTimer()
{
#if defined FB_DEBUG
// read_data(x) returns integer only
server_print("[AMX] FirstBlood::onRoundTimer(%d)", read_data(1))
#endif
if((get_cvar_num("mp_roundtime") * 60) == read_data(1))
switchEvent()

return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public switchEvent()
{
#if defined FB_DEBUG
server_print("[AMX] FirstBlood::switchEvent()")
#endif
new fbmode[8]
new fbmode_bit

get_cvar_string("amx_fb_mode", fbmode, 7)
fbmode_bit = read_flags(fbmode)

if (fbmode_bit & FB_FLAG_FH) {
unpause("b", "damage_msg")
pause("b","death_msg")
}
else {
unpause("b", "death_msg")
pause("b","damage_msg")
}
}
//-----------------------------------------------------------------------------
public death_msg()
{
new aIndex = read_data(1)
new vIndex = read_data(2)

#if defined FB_DEBUG
server_print("[AMX] FirstBlood::death_msg(%d, %d)", aIndex, vIndex)
#endif

if (fb_event(aIndex, vIndex))
pause("b", "death_msg") // very important! =)

return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public damage_msg()
{
#if defined FB_DEBUG
server_print("[AMX] FirstBlood::damage_msg()")
#endif
new vIndex = read_data(0) // index of player who has just died
new aIndex = get_user_attacker(vIndex) // get attacker's id (0 if nobody)

if(fb_event(aIndex, vIndex))
pause("b","damage_msg") // very important! =)

return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
fb_event(aIndex, vIndex)
{
#if defined FB_DEBUG
server_print("[AMX] FirstBlood::fb_event(%d, %d)", aIndex, vIndex)
#endif
new bool:bCheckTeams = true

if(!aIndex || aIndex == vIndex) // common check
return false
if(g_bUnderCS) {
if(cvar_exists("csdm_active") && get_cvar_num("csdm_active"))
if(get_cvar_num("csdm_kill_all")) bCheckTeams = false
}
else
if(!get_cvar_num("mp_teamplay")) bCheckTeams = false
if(bCheckTeams && (get_user_team(aIndex) == get_user_team(vIndex)))
return false

new sMsg[128]
new aName[32]
new fbmode[8]

get_cvar_string("amx_fb_mode", fbmode, 7)
new fbmode_bit = read_flags(fbmode)

get_user_name(aIndex, aName, 31)
format(sMsg, 127, "%s drew first blood", aName)

if ((fbmode_bit & FB_FLAG_NO_HUD) != FB_FLAG_NO_HUD) {
new iPlayerID = -1 // 0 - everybody
if (fbmode_bit & FB_FLAG_HUD_E) iPlayerID = 0
if (fbmode_bit & FB_FLAG_HUD_A) iPlayerID = aIndex

if(iPlayerID >= 0) {
// (r,g,b, x,y, effects,fxtime(?), holdtime, fadeintime, fadeouttime, channel(?));
set_hudmessage(170,0,0, -1.0,0.30, 0,6.0, 2.0, 0.3,2.0, 2)
show_hudmessage(iPlayerID, sMsg)
}
}

if (fbmode_bit & FB_FLAG_CHAT) client_print(0, print_chat, "%s", sMsg)
if (fbmode_bit & FB_FLAG_SND) client_cmd(aIndex, "spk misc/firstblood")

return true
}

Any help will be great

Regards

Blobby

MBosta
06-22-2007, 06:49 PM
public plugin_init()
{
g_bUnderCS = (is_running("cstrike") || is_running("czero"))

I doubt it.

blobby
06-22-2007, 06:57 PM
Ok would it be possible to make it work for dod or would it be a massive job

FeuerSturm
06-22-2007, 08:15 PM
@blobby & others:

try this out, should work, haven't tested it though!

cvar to enable/disable:
dod_firstblood <1/0>

Enjoy! :D

blobby
06-23-2007, 03:11 AM
Ok ill give this ago soon as i can cheers m8y ill let you know if this works

regards

blobby

blobby
06-23-2007, 03:33 AM
SPOT ON MY SON it works a treat m8 thanks alot i dont suppose you have the one with the old quake sounds on to do you like holyshit and stuff but thats great the first blood no problems at all +karama for you.

regards

Blobby

blobby
06-23-2007, 07:29 AM
LMAO yeah and they are useless its mainly cs stuff dont you think every thing that would be good for dod on there is for cs and wont work lol