First of all, once again:
I'm not a coder, so don't blame me for my lame methods. It's not a plugin, it's modified sourcecode.
Ok, what I did at first. I searched for zombieme function and found zombie/nemesis transformation (id,0,
0,0), so red number won't have only 0\1 (zombie/nemesis), but also 2 (garg).
Here how it looks like (part of code):
Code:
// Zombie Me Function (player id, infector, turn into a nemesis, special mode)
zombieme(id, infector, nemesis, specialmode)
{
// Pre user infect forward
ExecuteForward(g_fwUserInfected_pre, g_fwDummyResult, id, infector)
// Show zombie class menu if they haven't chosen any (e.g. just connected)
if (g_zombieclass[id] == ZCLASS_NONE && get_pcvar_num(cvar_zclasses))
set_task(2.0, "show_menu_zclass", id)
// Set selected zombie class
g_zombieclass[id] = g_zombieclassnext[id]
// Way to go...
g_zombie[id] = true
g_survivor[id] = false
// Set zombie attributes based on the mode
if (!specialmode)
{
if (nemesis == 1)
{
// Nemesis
g_nemesis[id] = true
// Get nemesis health setting
static nemhealth
nemhealth = get_pcvar_num(cvar_nemhp)
// Set health [0 = auto]
if (!nemhealth)
fm_set_user_health(id, g_zclass_hp[0]*(fnGetHumans()+1))
else
fm_set_user_health(id, nemhealth)
// Set gravity
set_pev(id, pev_gravity, get_pcvar_float(cvar_nemgravity))
}
else if (nemesis == 2)
{
// Garg
g_garg[id] = true
// Get garg health setting
static garghealth
garghealth = get_pcvar_num(cvar_garghp)
// Set health [0 = auto]
if (!garghealth)
fm_set_user_health(id, g_zclass_hp[0]*(fnGetHumans()+1)*3) // Garg's hp
else
fm_set_user_health(id, g_zclass_hp[0]*(fnGetHumans()+1)*3) // Garg's hp in any way
// Set gravity
set_pev(id, pev_gravity, get_pcvar_float(cvar_garggravity))
}
My server calculates nemesis hp by "players count * zombie health" and classes are turned off, so basically it's "players count * 1800". I wanted to make Garg A LOT more stronger (three times), so as you can see I did:
Code:
if (!garghealth)
fm_set_user_health(id, g_zclass_hp[0]*(fnGetHumans()+1)*3) // Garg's hp
else
fm_set_user_health(id, g_zclass_hp[0]*(fnGetHumans()+1)*3) // Garg's hp in any way
Cuz I won't change it anyway.
Then I added
all needed stuff for Garg. Basically I searched for ANYTHING that is used by nemesis (98%, didn't touched nemdamage, cuz it's pointless for Garg) and modified a copy-paste.
All cvars, natives, consts, updated lang file, include, added needed modules from flamezombie class to the sourcecode, admin stuff etc etc etc and player var is called
g_garg (just took
all needed stuff with "nem" and modified it, then added it to the source code. Also added
all checks that nemesis has, besides damage, once again it's completely modified copy-paste of nemesis). 0 warnings, 0 errors. Compiles fine, however, now Garg is just like nemesis, but deals damage with his claws like with normal knife. But I want him to have a flamethrower.
Now the hardest part comes: I have NO idea how to correctly transfer flamezombie's flamethrower.
Added to the "game vars":
Code:
new smoke
new fire
new burning
new isburning[33]
new tkcount[33]
new gmsgDeathMsg
new gmsgScoreInfo
new bool:flame[33]
Added to the "plugin precache":
Code:
fire = precache_model("sprites/explode1.spr")
smoke = precache_model("sprites/steam1.spr")
burning = precache_model("sprites/xfire.spr")
precache_sound("ambience/burning1.wav")
precache_sound("ambience/flameburst1.wav")
precache_sound("scientist/c1a0_sci_catscream.wav")
precache_sound("vox/_period.wav")
precache_sound("player/headshot2.wav")
To the "plugin init":
Code:
register_cvar("amx_flamethrower_tkpunish1", "0")
register_cvar("amx_flamethrower_tkpunish2", "0")
register_cvar("amx_fl_hp", "10")
// register_logevent("round_start", 2, "1=Round_Start")
// register_logevent("round_end", 2, "1=Round_End")
register_forward(FM_PlayerPreThink,"FM_PreThink")
Why this is commented?
Code:
// register_logevent("round_start", 2, "1=Round_Start")
// register_logevent("round_end", 2, "1=Round_End")
Cuz there's already
Code:
register_logevent("logevent_round_start",2, "1=Round_Start")
register_logevent("logevent_round_end", 2, "1=Round_End")
In a sourcecode, I will change this in flamezombie code.
Now part about what I'm completely unsure:
After setgravity for Garg I've added
Code:
if (g_garg[id])
{
new cost = get_cvar_num("amx_fl_hp");
fire_flamethrower(id);
flame[id]=true
}
amx_fl_hp will be set to 0 in any way, didn't wanted to remove that.
And after that I simply pasted everything from flamezombie starting from:
Code:
fire_flamethrower(id){
Until
Code:
public stop_firesound(args[]){
isburning[args[0]] = 0
emit_sound(args[0], CHAN_ITEM, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_CONTINUE
}
all parts with z_flame changed to g_garg
added in a start/end round, client connect (putinserver) / disconnect
And "FM_PreThink" part pasted to "Forward Player PreThink".
IN_USE changed to IN_ATTACK (so players will use flamethrower with not +use button, but with +attack button).
It's lame, I know, but I have no idea what else can I do, i'm not a coder.
In the end it gives me:
Quote:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
Error: Invalid function call, not a valid address on line 1308
Error: Undefined symbol "id" on line 1308
Warning: Expression has no effect on line 1308
(complaints about "flame[d]=false" at logevent_round_start)
Error: Undefined symbol "id" on line 1318
Warning: Expression has no effect on line 1318
Same for flame[id]=false on logevent_round_end.
Warning: Function "fw_PlayerPreThink" should return a value on line 2379
Complaits about ";" in return;. Without ; -- no error.
Error: Undefined symbol "zp_get_user_zombie" on line 2411
Error: Function uses both "return" and "return <value>" on line 2411
Error: Undefined symbol "get_user_button" on line 2414
Error: Undefined symbol "get_user_oldbutton" on line 2415
Error: Array must be indexed (variable "g_garg") on line 2416
Error: Function uses both "return" and "return <value>" on line 2423
Error: Undefined symbol "set_user_health" on line 2425
Error: Undefined symbol "fire_flamethrower" on line 2426
Error: Undefined symbol "get_entity_flags" on line 2429
Warning: Function "fw_PlayerPreThink" should return a value on line 2461
Warning: Loose indentation on line 4837
Error: Undefined symbol "fire_flamethrower" on line 4840
Warning: Symbol is assigned a value that is never used: "cost" on line 4842
Warning: Loose indentation on line 4843
Error: Undefined symbol "fire_flamethrower" on line 4843
Error: Undefined symbol "sqrt" on line 4920
Error: Undefined symbol "check_burnzone" on line 4933
Warning: Symbol is assigned a value that is never used: "radius" on line 4938
Warning: Symbol is assigned a value that is never used: "speed2" on line 4938
Warning: Symbol is assigned a value that is never used: "speed1" on line 4938
Warning: Unreachable code on line 4940
Error: Invalid expression, assumed zero on line 4940
Error: Undefined symbol "te_spray" on line 4940
Error: Undefined symbol "args" on line 4945
Warning: Expression has no effect on line 4945
Error: Expected token: ";", but found "]" on line 4945
Error: Invalid expression, assumed zero on line 4945
Error: Too many error messages on one line on line 4945
Dont even want to comment this
Compilation aborted.
22 Errors.
|
Can any experienced coder help me to give Garg a flamethrower? Please, contact me!