Raised This Month: $ Target: $400
 0% 

compilation errors battlemage plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aarvid
Junior Member
Join Date: Feb 2005
Old 03-03-2005 , 04:21   compilation errors battlemage plugin
Reply With Quote #1

When i try to compile this plugin i get the following errors

i use amxmodx 1.0

//// battlemages.sma
// bmgeneralfuncs.inc : error 017: undefined symbol "s"
// bmgeneralfuncs.inc : error 017: undefined symbol "d"
// bmgeneralfuncs.inc : error 017: undefined symbol "s"
// bmgeneralfuncs.inc : fatal error 107: too many error messages on one line

//
// compilation aborted.
// 4 errors.
// could not locate output file compiled\battlemages.amx (compile failed).
//
// compilation time: 0,16 sec

how do i fix this?
Aarvid is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-03-2005 , 09:08  
Reply With Quote #2

You could start by showing us the code...
xeroblood is offline
Send a message via MSN to xeroblood
Aarvid
Junior Member
Join Date: Feb 2005
Old 03-03-2005 , 14:01  
Reply With Quote #3

sry didn´t think of that

Files:
• battlemages.sma
• bmconst.inc
• bmelemental.inc
• bmenergy.inc
• bmgeneralfuncs.inc
• bmgvars.inc
• bmhelp.inc
• bmillusion.inc
• bmlife.inc


//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* battlemages.sma *
//* *
//********************************************* ******************

#include <amxmodx>
#include <amxmisc>
#include <string>
#include <fun>
#include <engine>

#include "effectconst"

// Include files to separate code - makes it easier to read.
#include "bmconst"
#include "bmgvars"
#include "bmhelp"

// Cast magic functions
#include "bmelemental"
#include "bmenergy"
#include "bmillusion"
#include "bmlife"
#include "bmgeneralfuncs"

public plugin_precache()
{
// Precache sprites
g_spriteBurning = precache_model("sprites/xfire.spr");
g_spriteLightning = precache_model("sprites/lgtning.spr");
g_spriteShockwave = precache_model("sprites/shockwave.spr");
g_spriteExplosion = precache_model("sprites/zerogxplode.spr");
g_spriteSmoke = precache_model("sprites/steam1.spr");

// Precache Sounds
if (file_exists("sound/battlemages/fireball.wav"))
precache_sound("battlemages/fireball.wav");
if (file_exists("sound/battlemages/cure.wav"))
precache_sound("battlemages/cure.wav");
if ( file_exists("sound/battlemages/lightningbolt.wav") )
precache_sound("battlemages/lightningbolt.wav");
if ( file_exists("sound/battlemages/invisibility.wav") )
precache_sound("battlemages/invisibility.wav");
if ( file_exists("sound/battlemages/earthquake.wav") )
precache_sound("battlemages/earthquake.wav");
if ( file_exists("sound/battlemages/coldwind.wav") )
precache_sound("battlemages/coldwind.wav");
if ( file_exists("sound/battlemages/thunder_speed.wav") )
precache_sound("battlemages/thunder_speed.wav");
if ( file_exists("sound/battlemages/shield.wav") )
precache_sound("battlemages/shield.wav");
if ( file_exists("sound/battlemages/regeneration.wav") )
precache_sound("battlemages/regeneration.wav");
if ( file_exists("sound/battlemages/mind_blast.wav") )
precache_sound("battlemages/mind_blast.wav");
if ( file_exists("sound/battlemages/planar_armor.wav") )
precache_sound("battlemages/planar_armor.wav");

return PLUGIN_CONTINUE;
}

public plugin_init()
{
register_plugin("Battle Mages", "0.1.4", "Van der Cal");

// Magic commands
register_clcmd("bm_castmagic" , "ClCmdCastMagic");
register_clcmd("bm_nextmagic" , "ClCmdNextMagic");
register_clcmd("bm_prevmagic" , "ClCmdPrevMagic");
register_clcmd("bm_changeschool" , "ClCmdChangeSchool");

// bmhelp.inc ClCmdHelp function
register_clcmd("bm_help" , "ClCmdHelp");

// bmhelp.inc ClCmdSchoolHelp function
register_clcmd("bm_schoolhelp" , "ClCmdSchoolHelp");

// Say handler
register_clcmd("say","SayHandler");
register_clcmd("say_team","SayHandler");

// Testing
//register_clcmd("t1", "ClCmdT1");

// Menu Commands
register_menucmd(register_menuid("Select School:"), 1023, "SchoolChoice" );

// Events
register_event("ResetHUD", "NewRound", "b");
register_event("CurWeapon","ChangeWeapon","be ","1=1");

register_event("SetFOV","Zoomed","be","1<90") ;
register_event("SetFOV","Unzoomed","be","1=90 ");

register_event("Damage", "DamageEvent", "b", "2!0");

// cvars
// Magic Points available at start
register_cvar(CVAR_START_MAGIC_POINTS, "30", FCVAR_SERVER);
// Amount of time(seconds) you have to wait until you can cast magic again
register_cvar(CVAR_MAGIC_COOLDOWN, "15", FCVAR_SERVER);
// Where to position the player information
register_cvar(CVAR_PLAYER_INFO_POSITION, "0", FCVAR_SERVER);

// Get game message id:s
g_iGameMsgScrShake = get_user_msgid("ScreenShake");
g_iGameMsgDeath = get_user_msgid("DeathMsg");

// Run config file
new sConfigFilepath[64];
get_customdir(sConfigFilepath, 63);
format(sConfigFilepath, 63, "%s/battlemages/battlemages.cfg", sConfigFilepath);
server_cmd("exec %s",sConfigFilepath);

return PLUGIN_CONTINUE;
}

//public ClCmdT1(iPlayerID)
//{
// client_print(iPlayerID, print_center, "Current health: %d", get_user_health(iPlayerID));
// return PLUGIN_HANDLED;
//}

// Function that will run when a player connects to the server
public client_connect(id)
{
// Reset values
g_iArrPlayersSchool[id] = WARRIOR;
g_iArrPlayersMP[id] = 0;
g_iArrPlayersSelMagic[id] = 0;
g_iArrPlSelMagicPower[id] = 0;
g_iArrPlSelMagicCost[id] = 0;
g_iArrPlayersMaxHP[id] = 100;
g_bArrPlayersIsHasted[id] = false;
g_bArrPlayersIsSlowed[id] = false;
g_bArrPlayersIsMagicReady[id] = true;
g_iArrPlayersNextSchool[id] = DONT_CHANGE_SCHOOL;
g_bArrPlayersIsZoomMode[id] = false;
g_bArrPlayersDeathMsgShown[id] = false;
g_bArrPlayersHasMagmaShield[id] = false;
}

// Client Command functions

public ClCmdCastMagic(iPlayerID)
{
if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )
{
client_print(iPlayerID, print_center, "Warriors are not able to wield magic");
return PLUGIN_HANDLED;
}

if ( g_iArrPlayersSchool[iPlayerID] > NUMBER_OF_SCHOOLS )
{
server_print("[BM] ERROR: Player belongs to a school that doesnt exist");
g_iArrPlayersSchool[iPlayerID] = WARRIOR;
return PLUGIN_HANDLED;
}

if ( !g_bArrPlayersIsMagicReady[iPlayerID] )
return PLUGIN_HANDLED;

if ( !is_user_alive(iPlayerID) )
return PLUGIN_HANDLED;

new iSpellID = g_iArrPlayersSelMagic[iPlayerID];

if ( g_iArrPlayersMP[iPlayerID] - g_iArrPlSelMagicCost[iPlayerID] < 0 )
{
client_print(iPlayerID, print_center, "You dont have enough MP to cast the spell");
return PLUGIN_HANDLED;
}

new bool:bCastMagic = false;
new iTargetID, iBodyPartID;
switch ( g_iArrPlayersSchool[iPlayerID] )
{
case ELEMENTAL_MAGE:
{
switch( iSpellID )
{
case FIREBALL:
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmelemental.inc CastFireBall function
CastFireBall(iPlayerID);
}
case ICE_IMPLOSION:
{
get_user_aiming(iPlayerID, iTargetID, iBodyPartID);
if ( iTargetID > 0 && iTargetID <= 32 )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmelemental.inc CastIceImplosion function
CastIceImplosion(iPlayerID);
}
}
case MAGMA_SHIELD:
{
if ( !g_bArrPlayersHasMagmaShield[iPlayerID] )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmelemental.inc CastMagmaShield function
CastMagmaShield(iPlayerID);
}
}
}
}
case ENERGY_MAGE:
{
switch( iSpellID )
{
case LIGHTNING_STRIKE:
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmenergy.inc CastLightningStrike function
CastLightningStrike(iPlayerID);
}
case LIGHTNING_SPEED:
{
// if we arent slowed or already hasted.
if ( !g_bArrPlayersIsSlowed[iPlayerID] && !g_bArrPlayersIsHasted[iPlayerID] )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
g_bArrPlayersIsHasted[iPlayerID] = true;
// bmenergy.inc CastLightningSpeed function
CastLightningSpeed(iPlayerID);
}
}
case PLANAR_ARMOR:
{
if ( get_user_armor(iPlayerID) <= 100 )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmenergy.inc CastPlanarShield function
CastPlanarArmor(iPlayerID);
}
}
}
}
case ILLUSION_MAGE:
{
switch( iSpellID )
{
case INVISIBILITY:
{
SpellCooldown(iPlayerID);
bCastMagic = true;
// bmillusion.inc CastInvisibility function
CastInvisibility(iPlayerID);
}
case SHAKING_WORLD:
{
// if we are aiming on a player...
get_user_aiming(iPlayerID, iTargetID, iBodyPartID);
if ( iTargetID > 0 && iTargetID <= 32 )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmillusion.inc CastShakingWorld function
CastShakingWorld(iPlayerID);
}
}
case MIND_BLAST:
{
bCastMagic = true;
SpellCooldown(iPlayerID);
CastMindBlast(iPlayerID);
}
}
}
case LIFE_MAGE:
{
switch( iSpellID )
{
case HEAL_SELF:
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmlife.inc CastHealSelf function
CastHealSelf(iPlayerID);
}
case HEAL_OTHER:
{
// if we are aiming on a teammate...
get_user_aiming(iPlayerID, iTargetID, iBodyPartID);
if ( iTargetID > 0 && iTargetID <= 32 )
{
if ( get_user_team(iPlayerID) == get_user_team(iTargetID) )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmlife.inc CastHealOther function
CastHealOther(iPlayerID);
}
}
}
case SHIELD_YLIEN:
{
// If not already enveloped in the shield of Y'lien...
if ( g_iArrPlayersMaxHP[iPlayerID] < 101 )
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmlife.inc CastShieldYlien function
CastShieldYlien(iPlayerID);
}
}
case REGENERATION:
{
bCastMagic = true;
SpellCooldown(iPlayerID);
// bmlife.inc CastRegeneration function
CastRegeneration(iPlayerID);
}
}
}
default:
{
return PLUGIN_HANDLED;
}
}

// if we did cast magic
if (bCastMagic)
{
g_iArrPlayersMP[iPlayerID] -= g_iArrPlSelMagicCost[iPlayerID];
DisplayPlayerInfo(iPlayerID);
}
return PLUGIN_HANDLED;
}

public ClCmdNextMagic(iPlayerID)
{
if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )
{
client_print(iPlayerID, print_center, "Warriors are not able to wield magic");
return PLUGIN_HANDLED;
}

if ( g_iArrPlayersSelMagic[iPlayerID] + 1 < g_nArrSpellsInSchool[g_iArrPlayersSchool[iPlayerID]] )
g_iArrPlayersSelMagic[iPlayerID]++;
else
g_iArrPlayersSelMagic[iPlayerID] = 0;

SetSpellSettings(iPlayerID);

DisplayPlayerInfo(iPlayerID);

return PLUGIN_HANDLED;
}

public ClCmdPrevMagic(iPlayerID)
{
if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )
{
client_print(iPlayerID, print_center, "Warriors are not able to wield magic");
return PLUGIN_HANDLED;
}

if ( g_iArrPlayersSelMagic[iPlayerID] > 0 )
g_iArrPlayersSelMagic[iPlayerID]--;
else
g_iArrPlayersSelMagic[iPlayerID] = g_nArrSpellsInSchool[g_iArrPlayersSchool[iPlayerID]] - 1;

SetSpellSettings(iPlayerID);

DisplayPlayerInfo(iPlayerID);

return PLUGIN_HANDLED;
}

public ClCmdChangeSchool(iPlayerID)
{
//g_bArrPlayersSelSchoolPending[iPlayerID] = true;
//console_print(iPlayerID, "[BM] A menu will appear at the start of the next round.");
DisplayChooseSchool(iPlayerID);
return PLUGIN_HANDLED;
}

public SayHandler(iPlayerID)
{
new sSaid[32];
read_args(sSaid,31);

if ( equali(sSaid,"\"/bm_help\"") || equali(sSaid,"\"bm_help\"") || equali(sSaid,"\"/bmhelp\"") || equali(sSaid,"\"bmhelp\"") )
DisplayHelp(iPlayerID); // bmhelp.inc DisplayHelp function
else if ( equali(sSaid,"\"/bm_schoolinfo\"") || equali(sSaid,"\"bm_schoolinfo\"") || equali(sSaid,"\"/bmschoolinfo\"") || equali(sSaid,"\"bmschoolinfo\"") )
DisplaySchoolHelp(iPlayerID); // bmhelp.inc DisplaySchoolHelp function
else if ( equali(sSaid,"\"/bm_schoolhelp\"") || equali(sSaid,"\"bm_schoolhelp\"") || equali(sSaid,"\"/bmschoolhelp\"") || equali(sSaid,"\"bmschoolhelp\"") )
DisplaySchoolHelp(iPlayerID); // bmhelp.inc DisplaySchoolHelp function
}

// Private functions aiding client command functions

SetSpellSettings(iPlayerID)
{
switch( g_iArrPlayersSchool[iPlayerID])
{
case ELEMENTAL_MAGE:
{
g_iArrPlSelMagicPower[iPlayerID] = g_iArrElementalMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrElementalMagicCost[g_iArrPlayersSelMagic[iPlayerID]];
}
case ENERGY_MAGE:
{
g_iArrPlSelMagicPower[iPlayerID] = g_iArrEnergyMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrEnergyMagicCost[g_iArrPlayersSelMagic[iPlayerID]];
}
case ILLUSION_MAGE:
{
g_iArrPlSelMagicPower[iPlayerID] = g_iArrIllusionMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrIllusionMagicCost[g_iArrPlayersSelMagic[iPlayerID]];
}
case LIFE_MAGE:
{
g_iArrPlSelMagicPower[iPlayerID] = g_iArrLifeMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrLifeMagicCost[g_iArrPlayersSelMagic[iPlayerID]];
}
}
}

// Event functions

public NewRound(iPlayerID)
{
if ( g_iArrPlayersNextSchool[iPlayerID] != DONT_CHANGE_SCHOOL && g_iArrPlayersSchool[iPlayerID] != g_iArrPlayersNextSchool[iPlayerID] )
ChangeSchool(iPlayerID);
else if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )
DisplayChooseSchool(iPlayerID);

RemoveActiveSpells(iPlayerID);

g_bArrPlayersIsZoomMode[iPlayerID] = false;
g_bArrPlayersDeathMsgShown[iPlayerID] = false;

return PLUGIN_CONTINUE;
}

public ChangeWeapon(iPlayerID)
{
if ( g_bArrPlayersIsHasted[iPlayerID] )
set_user_maxspeed(iPlayerID, float(LIGHTNING_SPEED_POWER));
else if ( g_bArrPlayersIsSlowed[iPlayerID] )
set_user_maxspeed(iPlayerID, ICE_IMPLOSION_SLOW_SPEED);

return PLUGIN_CONTINUE;
}

public SchoolChoice(iPlayerID, iSchoolKey)
{
if ( iSchoolKey >= 0 && iSchoolKey < NUMBER_OF_SCHOOLS)
{
// Check if the player already belongs to that school
if ( iSchoolKey + 1 != g_iArrPlayersSchool[iPlayerID] )
{
g_iArrPlayersNextSchool[iPlayerID] = iSchoolKey + 1;
if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )
ChangeSchool(iPlayerID);
else
client_print(iPlayerID, print_center, "Your choice has been noted, you will change school next round");
}
else
{
g_iArrPlayersNextSchool[iPlayerID] = DONT_CHANGE_SCHOOL;
client_print(iPlayerID, print_center, "You are part of that school already");
}
}

return PLUGIN_CONTINUE;
}

public Zoomed(iPlayerID)
g_bArrPlayersIsZoomMode[iPlayerID] = true;

public Unzoomed(iPlayerID)
g_bArrPlayersIsZoomMode[iPlayerID] = false;

public DamageEvent(iVictimID)
{
if ( g_bArrPlayersHasMagmaShield[iVictimID] )
{
new iDamage = read_data(2);
new iAttackerID, iBodyPartID, iWeaponID;
iAttackerID = get_user_attacker(iVictimID, iWeaponID, iBodyPartID);

// bmelemental.inc AttackOnMagmaShield function
AttackOnMagmaShield(iVictimID, iAttackerID, iDamage, iBodyPartID, iWeaponID);
}
}

// General Functions

RemoveActiveSpells(iPlayerID)
{
if ( task_exists(INVISIBILITY_DURATION_TASK_ID + iPlayerID) ) // Removes active Invisibility Spells
{
remove_task(INVISIBILITY_DURATION_TASK_ID + iPlayerID);
set_user_rendering(iPlayerID);
}

if ( task_exists(ICE_IMPLOSION_DOT_TASK_ID + iPlayerID) ) // Removes active Ice Implosion Spells
remove_task(ICE_IMPLOSION_DOT_TASK_ID + iPlayerID);

if ( task_exists(FIREBALL_FLY_TASK_ID + iPlayerID) ) // Removes active Fireball
remove_task(FIREBALL_FLY_TASK_ID + iPlayerID);

if ( task_exists(SPELL_COOLDOWN_TASK_ID + iPlayerID) ) // Removes active spell cooldowns
remove_task(SPELL_COOLDOWN_TASK_ID + iPlayerID);

if ( task_exists(LIGHTNING_SPEED_TASK_ID + iPlayerID) ) // Removes active Lightning Speed Spells
remove_task(LIGHTNING_SPEED_TASK_ID + iPlayerID);

if ( g_bArrPlayersIsSlowed[iPlayerID] || g_bArrPlayersIsHasted[iPlayerID] )
{
// bmgeneralfuncs.inc ResetMaxSpeed function
ResetMaxSpeed(iPlayerID);
}

if ( task_exists(MIND_BLAST_TASK_ID + iPlayerID) ) // Removes active Mind Blast Spells
remove_task(MIND_BLAST_TASK_ID + iPlayerID);

if ( task_exists(REGENERATION_TASK_ID + iPlayerID) ) // Removes active Regeneration Spells
remove_task(REGENERATION_TASK_ID + iPlayerID);

if ( get_user_armor(iPlayerID) > 100 ) // Removes active planar armor spells
set_user_armor(iPlayerID, 100);

if ( g_bArrPlayersHasMagmaShield[iPlayerID] ) // Remove active magma shield spells
{
g_bArrPlayersHasMagmaShield[iPlayerID] = false;
}

set_user_rendering(iPlayerID);
g_iArrPlayersMP[iPlayerID] = get_cvar_num(CVAR_START_MAGIC_POINTS);
g_iArrPlayersMaxHP[iPlayerID] = 100;
g_bArrPlayersIsMagicReady[iPlayerID] = true;
g_bArrPlayersIsHasted[iPlayerID] = false;
}

public SpellCooldown(iPlayerID)
{
g_bArrPlayersIsMagicReady[iPlayerID] = false;
new args[1];
args[0] = iPlayerID;
set_task(float(get_cvar_num(CVAR_MAGIC_COOLDO WN)), "ReadyToCast", SPELL_COOLDOWN_TASK_ID + iPlayerID, args, 1);
}

public ReadyToCast(args[])
{
g_bArrPlayersIsMagicReady[args[0]] = true;
client_print(args[0], print_center, "You have regained your focus and can cast your next spell.");
}

ChangeSchool(iPlayerID)
{
switch ( g_iArrPlayersNextSchool[iPlayerID] )
{
case ELEMENTAL_MAGE:
{
g_iArrPlayersSchool[iPlayerID] = ELEMENTAL_MAGE;
g_iArrPlSelMagicPower[iPlayerID] = g_iArrElementalMagicPowers[INITIAL_SPELL];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrElementalMagicCost[INITIAL_SPELL];
}
case ENERGY_MAGE:
{
g_iArrPlayersSchool[iPlayerID] = ENERGY_MAGE;
g_iArrPlSelMagicPower[iPlayerID] = g_iArrEnergyMagicPowers[INITIAL_SPELL];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrEnergyMagicCost[INITIAL_SPELL];
}
case ILLUSION_MAGE:
{
g_iArrPlayersSchool[iPlayerID] = ILLUSION_MAGE;
g_iArrPlSelMagicPower[iPlayerID] = g_iArrIllusionMagicPowers[INITIAL_SPELL];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrIllusionMagicCost[INITIAL_SPELL];
}
case LIFE_MAGE:
{
g_iArrPlayersSchool[iPlayerID] = LIFE_MAGE;
g_iArrPlSelMagicPower[iPlayerID] = g_iArrLifeMagicPowers[INITIAL_SPELL];
g_iArrPlSelMagicCost[iPlayerID] = g_iArrLifeMagicCost[INITIAL_SPELL];
}
}
g_bArrPlayersIsMagicReady[iPlayerID] = true;
g_iArrPlayersSelMagic[iPlayerID] = INITIAL_SPELL;

g_iArrPlayersNextSchool[iPlayerID] = DONT_CHANGE_SCHOOL;
DisplayPlayerInfo(iPlayerID);
}

// Display Functions

public DisplayChooseSchool(iPlayerID)
{
new sMenu[MAX_MENU_SIZE];

format(sMenu,MAX_MENU_SIZE,"Select School:\n\n1. %s\n2. %s\n3. %s\n4. %s\n9. Exit", g_sArrMagicSchools[ELEMENTAL_MAGE],
g_sArrMagicSchools[ENERGY_MAGE], g_sArrMagicSchools[ILLUSION_MAGE], g_sArrMagicSchools[LIFE_MAGE]);
show_menu(iPlayerID, (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<9), sMenu, -1);
}

DisplayPlayerInfo(iPlayerID)
{
new sActiveSpellName[MAX_CHARS_SPELL_NAME];

switch ( g_iArrPlayersSchool[iPlayerID] )
{
case WARRIOR: sActiveSpellName = "None";
case ELEMENTAL_MAGE: format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrElementalMagics[g_iArrPlayersSelMagic[iPlayerID]]);
case ENERGY_MAGE: format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrEnergyMagics[g_iArrPlayersSelMagic[iPlayerID]]);
case ILLUSION_MAGE: format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrIllusionMagics[g_iArrPlayersSelMagic[iPlayerID]]);
case LIFE_MAGE: format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrLifeMagics[g_iArrPlayersSelMagic[iPlayerID]]);
}

new iPlayerInfoPosition = get_cvar_num(CVAR_PLAYER_INFO_POSITION);
switch ( iPlayerInfoPosition )
{
case POSITION_DOWN_LEFT:
set_hudmessage(200, 200, 200, -2.0, 0.75, 0, 6.0, 2.0, 0.1, 0.5,HUD_PLAYERINFO);
case POSITION_DOWN_RIGHT:
set_hudmessage(200, 200, 200, 1.0, 0.75, 0, 6.0, 2.0, 0.1, 0.5,HUD_PLAYERINFO)
case POSITION_DOWN_CENTER:
set_hudmessage(200, 200, 200, -1.0, 0.75, 0, 6.0, 2.0, 0.1, 0.5,HUD_PLAYERINFO)
default:
{
server_print("[BM] Error in cvar %s, invalid value", CVAR_PLAYER_INFO_POSITION);
return PLUGIN_CONTINUE;
}
}

show_hudmessage(iPlayerID, "School: %s\nActive Spell: %s, Cost: %dMP\nMP Left: %d",
g_sArrMagicSchools[g_iArrPlayersSchool[iPlayerID]], sActiveSpellName, g_iArrPlSelMagicCost[iPlayerID], g_iArrPlayersMP[iPlayerID]);
return PLUGIN_CONTINUE;
}

//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* bmconst.inc *
//* *
//********************************************* ******************

#if !defined BATTLE_MAGES_CONSTANTS
#define BATTLE_MAGES_CONSTANTS

// General Defines
#define MAX_MENU_SIZE 512
#define INITIAL_SPELL 0
#define PLAYER_RADIUS 80
#define MAX_CHARS_SPELL_NAME 20
#define MAX_CHARS_SCHOOL_NAME 32
#define HUD_PLAYERINFO 1
#define DONT_CHANGE_SCHOOL 0
#define DONT_REMOVE_FRAG 1 // for user_kill function
#define NOT_USED 0
#define GET_AIM_ENTITY_HIT 3 // For use with get_user_origin, mode 3
#define ABNORMAL_HEALTH 1024

// CVAR names
#define CVAR_MAGIC_COOLDOWN "mp_magicdelay"
#define CVAR_START_MAGIC_POINTS "mp_startmp"
#define CVAR_PLAYER_INFO_POSITION "mp_bmplayerinfopos"

// Player info positions
#define POSITION_DOWN_LEFT 0
#define POSITION_DOWN_RIGHT 1
#define POSITION_DOWN_CENTER 2

// Task IDs
#define SPELL_COOLDOWN_TASK_ID 700
#define INVISIBILITY_DURATION_TASK_ID 735
#define FIREBALL_FLY_TASK_ID 770
#define EXPLOSION_TASK_ID 805
#define ICE_IMPLOSION_DOT_TASK_ID 840
#define LIGHTNING_SPEED_TASK_ID 875
#define SHAKE_WORLD_TASK_ID 910
#define MIND_BLAST_TASK_ID 945
#define REGENERATION_TASK_ID 980

// Magics sorted by school:
#define NUMBER_OF_SCHOOLS 4

#define WARRIOR 0
#define ELEMENTAL_MAGE 1
#define ENERGY_MAGE 2
#define ILLUSION_MAGE 3
#define LIFE_MAGE 4

// Elemental Magics
#define NUMBER_OF_MAGICS_ELEMENTAL 3

// Name of spell Type of spell

// Fireball AE Nuke
#define FIREBALL 0
#define FIREBALL_POWER 25 // times 3 area damage
#define FIREBALL_COST 7

#define FIREBALL_SPEED 80
#define FIREBALL_SIZE 20
#define NUMBER_LOOPS 3
#define EXPLOSION_RANGE 300
#define BLAST_RADIUS 250

// Ice Implosion DoT + Slow
#define ICE_IMPLOSION 1
#define ICE_IMPLOSION_POWER 5
#define ICE_IMPLOSION_COST 7
#define ICE_IMPLOSION_DURATION 60
#define ICE_IMPLOSION_TURNS 5
#define ICE_IMPLOSION_INTERVAL 2.0
#define ICE_IMPLOSION_SLOW_SPEED 125.0

// Magma Shield Round Buff
#define MAGMA_SHIELD 2
#define MAGMA_SHIELD_POWER 0.25 // %
#define MAGMA_SHIELD_COST 10
#define MAGMA_SHIELD_MIRROR_DMG 0.10 // %


// Energy Magics
#define NUMBER_OF_MAGICS_ENERGY 3

// Lightning Strike Nuke
#define LIGHTNING_STRIKE 0
#define LIGHTNING_STRIKE_POWER 50
#define LIGHTNING_STRIKE_COST 5

// Lightning Speed Duration Buff
#define LIGHTNING_SPEED 1
#define LIGHTNING_SPEED_POWER 330
#define LIGHTNING_SPEED_COST 10
#define LIGHTNING_SPEED_DURATION 30

// Planar Shield Round Buff
#define PLANAR_ARMOR 2
#define PLANAR_ARMOR_POWER 200
#define PLANAR_ARMOR_COST 10

// Leech Self Heal + DoT // ONLY AN IDEA SO FAR
#define LEECH 3
#define LEECH_POWER 10
#define LEECH_COST 10
#define LEECH_DURATION 30.0
#define LEECH_INTERVALS 2

// Illusion Magics
#define NUMBER_OF_MAGICS_ILLUSION 3

// Invisibility Duration Buff
#define INVISIBILITY 0
#define INVISIBILITY_POWER 50
#define INVISIBILITY_COST 10
#define INVISIBILITY_DURATION 30

// Shaking World Confusion
#define SHAKING_WORLD 1
#define SHAKING_WORLD_POWER 0 // Not used
#define SHAKING_WORLD_COST 5
#define SHAKING_WORLD_DURATION 5.0 // Duration / Interval
#define SHAKING_WORLD_INTERVALS 2 // 2 intervals are minimum

// Mind Blast AoE DoT + Confusion
#define MIND_BLAST 2
#define MIND_BLAST_POWER 20 // times 2 area damage
#define MIND_BLAST_COST 10
#define MIND_BLAST_DURATION 5.0 // Duration / Interval
#define MIND_BLAST_INTERVALS 2 // 2 intervals are minimum
#define MIND_BLAST_RANGE 300


// Life Magics
#define NUMBER_OF_MAGICS_LIFE 4

// Heal Self Healing
#define HEAL_SELF 0
#define HEAL_SELF_POWER 50
#define HEAL_SELF_COST 6

// Heal Other Healing
#define HEAL_OTHER 1
#define HEAL_OTHER_POWER 50
#define HEAL_OTHER_COST 6

// Shield of Y'lien Round Buff
#define SHIELD_YLIEN 2
#define SHIELD_YLIEN_POWER 50
#define SHIELD_YLIEN_COST 10

// Regeneration Healing
#define REGENERATION 3
#define REGENERATION_POWER 5 // HP/s
#define REGENERATION_COST 10
#define REGENERATION_DURATION 2.0 // Duration / Interval
#define REGENERATION_INTERVALS 20 // 1 interval is minimum

//


// Damage Causes
#define DMG_CAUSE_FIREBALL 0
#define DMG_CAUSE_LIGHTNING_STRIKE 1
#define DMG_CAUSE_ICE_IMPLOSION 2
#define DMG_CAUSE_MAGMA_SHIELD 3
#define DMG_CAUSE_MIND_BLAST 4

#endif

//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* bmelemental.inc *
//* *
//********************************************* ******************

#if !defined BATTLE_MAGES_ELEMENTAL_MAGIC
#define BATTLE_MAGES_ELEMENTAL_MAGIC

#include "bmconst"
#include "bmgvars"
#include "bmgeneralfuncs"

CastFireBall(iPlayerID)
{
new vecTarget[3];
new vecStep[3];
new vecOrigin[3];
// new float:fVecNewOrigin[3];
// new float:fVecHit[3];
// new float:fVecNewTarget[3];
new args[11];
new iDistance;
new nSteps;

get_user_origin(iPlayerID, vecOrigin);
get_user_origin(iPlayerID, vecTarget, GET_AIM_ENTITY_HIT);

/* new iEntityID;
// new iCount = 1;

fVecNewOrigin[0] = float(vecOrigin[0]);
fVecNewOrigin[1] = float(vecOrigin[1]);
fVecNewOrigin[2] = float(vecOrigin[2]);

fVecNewTarget[0] = float(vecTarget[0]);
fVecNewTarget[1] = float(vecTarget[1]);
fVecNewTarget[2] = float(vecTarget[2]);

iEntityID = trace_line(iPlayerID, fVecNewOrigin, fVecNewTarget, fVecHit);

client_print(0, print_center, "EntityID: %d, playerid: %d", iEntityID, iPlayerID);
*/
/*
while ( iEntityID <= 32 && iEntityID > 0 && iCount < 33)
{
fVecNewOrigin[0] = fVecNewTarget[0];
fVecNewOrigin[1] = fVecNewTarget[1];
fVecNewOrigin[2] = fVecNewTarget[2];

fVecNewTarget[0] = fVecHit[0];
fVecNewTarget[1] = fVecHit[1];
fVecNewTarget[2] = fVecHit[2];

iEntityID = trace_line(iEntityID, fVecNewOrigin, fVecNewTarget, fVecHit);
iCount++;
}

iDistance = get_distance(vecOrigin, fVecHit);
*/
iDistance = get_distance(vecOrigin, vecTarget);

nSteps = iDistance / FIREBALL_SPEED;


// vecStep[0] = (floatround(fVecHit[0]) - vecOrigin[0]) / nSteps;
// vecStep[1] = (floatround(fVecHit[1]) - vecOrigin[1]) / nSteps;
// vecStep[2] = (floatround(fVecHit[2]) - vecOrigin[2]) / nSteps;
vecStep[0] = (vecTarget[0] - vecOrigin[0]) / nSteps;
vecStep[1] = (vecTarget[1] - vecOrigin[1]) / nSteps;
vecStep[2] = (vecTarget[2] - vecOrigin[2]) / nSteps;

// args[0] = floatround(fVecHit[0]);
// args[1] = floatround(fVecHit[1]);
// args[2] = floatround(fVecHit[2]);
args[0] = vecTarget[0];
args[1] = vecTarget[1];
args[2] = vecTarget[2];
args[3] = iPlayerID;
args[4] = vecStep[0];
args[5] = vecStep[1];
args[6] = vecStep[2];
args[7] = vecOrigin[0];
args[8] = vecOrigin[1];
args[9] = vecOrigin[2];
args[10] = g_iArrPlSelMagicPower[iPlayerID];

if ( file_exists("sound/battlemages/fireball.wav") )
emit_sound(iPlayerID, CHAN_ITEM, "battlemages/fireball.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

set_task(0.1, "FireBallFly", FIREBALL_FLY_TASK_ID + iPlayerID, args, 11);

return PLUGIN_HANDLED;
}

public FireBallFly(args[])
{
new vecTarget[3];
vecTarget[0] = args[0];
vecTarget[1] = args[1];
vecTarget[2] = args[2];

new iCasterID = args[3];

new vecStep[3];
vecStep[0] = args[4];
vecStep[1] = args[5];
vecStep[2] = args[6];

new vecPos[3];
vecPos[0] = args[7];
vecPos[1] = args[8];
vecPos[2] = args[9];

vecPos[0] += vecStep[0];
vecPos[1] += vecStep[1];
vecPos[2] += vecStep[2];

if ( get_distance(vecTarget, vecPos) < PLAYER_RADIUS )
{
Explosion(vecTarget, iCasterID, args[10]);
return PLUGIN_CONTINUE;
}

new iArrPlayersID[32];
new nPlayers;

get_players(iArrPlayersID, nPlayers, "a");
new vecPlayerPos[3];

for (new iPlayer=0; iPlayer < nPlayers; iPlayer++)
{
if ( iArrPlayersID[iPlayer] != iCasterID )
{
get_user_origin(iArrPlayersID[iPlayer], vecPlayerPos);
if ( get_distance(vecPlayerPos, vecPos) < PLAYER_RADIUS )
{
Explosion(vecPlayerPos, iCasterID, args[10]);
return PLUGIN_CONTINUE;
}
}
}

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );

write_byte( TE_SPRITE );
write_coord(vecPos[0] - ( vecStep[0] / 3 * 2 ));
write_coord(vecPos[1] - ( vecStep[1] / 3 * 2 ));
write_coord(vecPos[2] - ( vecStep[2] / 3 * 2 ));
write_short( g_spriteBurning );
write_byte( FIREBALL_SIZE );
write_byte( 200 );
message_end();

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SPRITE );
write_coord(vecPos[0] - ( vecStep[0] / 3 ));
write_coord(vecPos[1] - ( vecStep[1] / 3 ));
write_coord(vecPos[2] - ( vecStep[2] / 3 ));
write_short( g_spriteBurning );
write_byte( FIREBALL_SIZE );
write_byte( 200 );
message_end();

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SPRITE );
write_coord(vecPos[0]);
write_coord(vecPos[1]);
write_coord(vecPos[2]);
write_short( g_spriteBurning );
write_byte( FIREBALL_SIZE );
write_byte( 200 );
message_end();

args[7] = vecPos[0];
args[8] = vecPos[1];
args[9] = vecPos[2];

set_task(0.1, "FireBallFly", FIREBALL_FLY_TASK_ID + iCasterID, args, 11);

return PLUGIN_CONTINUE;
}

Explosion(vecOrigin[], iCasterID, iDamage)
{
new args[6];

args[0] = vecOrigin[0];
args[1] = vecOrigin[1];
args[2] = vecOrigin[2];
args[3] = iCasterID;
args[4] = NUMBER_LOOPS;
args[5] = iDamage;

set_task(0.1, "Implosion", 1, vecOrigin, 3);
set_task(0.2, "Explode", EXPLOSION_TASK_ID + iCasterID, args, 6);
set_task(0.3, "BlastCircles", 2, vecOrigin, 3);

return PLUGIN_CONTINUE;
}

public Explode(args[])
{
new iCasterID = args[3];
new vecBlastPos[3];
vecBlastPos[0] = args[0];
vecBlastPos[1] = args[1];
vecBlastPos[2] = args[2];

message_begin( MSG_PVS, SVC_TEMPENTITY, vecBlastPos );
write_byte( TE_EXPLOSION);
write_coord( vecBlastPos[0] + random_num( -100, 100 ));
write_coord( vecBlastPos[1] + random_num( -100, 100 ));
write_coord( vecBlastPos[2] + random_num( -50, 50 ));
write_short( g_spriteExplosion );
write_byte( random_num(0, 20) + 20 );
write_byte( 12 );
write_byte( TE_EXPLFLAG_NONE );
message_end();

message_begin( MSG_PVS, SVC_TEMPENTITY, vecBlastPos );
write_byte( TE_SMOKE );
write_coord( vecBlastPos[0] + random_num( -100, 100 ));
write_coord( vecBlastPos[1] + random_num( -100, 100 ));
write_coord( vecBlastPos[2] + random_num( -50, 50 ));
write_short( g_spriteSmoke );
write_byte( 60 );
write_byte( 10 );
message_end();

new iArrPlayersID[32];
new nPlayers;

get_players(iArrPlayersID, nPlayers, "a");

new iTargetID;
new iDistanceBetween;
new vecTargetOrigin[3];
new iDamage;
new iMultiplier;

// bmgeneralfunc.inc IsFriendlyFireOn function
new bool:bFF = IsFriendlyFireOn();

for (new iPlayer = 0; iPlayer < nPlayers; iPlayer++)
{
iTargetID = iArrPlayersID[iPlayer];
get_user_origin(iTargetID, vecTargetOrigin);
iDistanceBetween = get_distance(vecBlastPos, vecTargetOrigin);

if ( get_user_team(iCasterID) != get_user_team(iTargetID) || iCasterID == iTargetID || bFF)
{
if ( iDistanceBetween < EXPLOSION_RANGE )
{
iMultiplier = args[5] * args[5] / EXPLOSION_RANGE;
// bmgeneralfunc.inc SquareRoot function
iDamage = SquareRoot((EXPLOSION_RANGE - iDistanceBetween) * iMultiplier);

// RadiusDamage(fVecOrigin, 1, 1);

// bmgeneralfunc.inc DoDamage function
DoDamage(iTargetID, iCasterID, iDamage, DMG_CAUSE_FIREBALL);
}
}
if (iDistanceBetween < EXPLOSION_RANGE)
{
message_begin(MSG_ONE, g_iGameMsgScrShake, {0,0,0}, iTargetID);
write_short( 1<<14 ); // Amplitude
write_short( 1<<13 ); // Duration
write_short( 1<<14 ); // Frequency
message_end();
}
}

if (--args[4] > 0)
set_task(0.1, "Explode", EXPLOSION_TASK_ID + iCasterID, args, 6);

return PLUGIN_CONTINUE;
}

public BlastCircles(vecBlastPos[3])
{
// Blast Circles
message_begin( MSG_PAS, SVC_TEMPENTITY, vecBlastPos );
write_byte( TE_BEAMCYLINDER );
write_coord( vecBlastPos[0]);
write_coord( vecBlastPos[1]);
write_coord( vecBlastPos[2] - 16);
write_coord( vecBlastPos[0]);
write_coord( vecBlastPos[1]);
write_coord( vecBlastPos[2] - 16 + BLAST_RADIUS);
write_short( g_spriteShockwave );
write_byte( 0 ); // Startframe
write_byte( 0 ); // Framerate
write_byte( 6 ); // Life
write_byte( 16 ); // Width
write_byte( 0 ); // Noise
write_byte( 188 );
write_byte( 220 );
write_byte( 255 );
write_byte( 255 ); // Brightness
write_byte( 0 ); // Speed
message_end();

message_begin( MSG_PAS, SVC_TEMPENTITY, vecBlastPos );
write_byte( TE_BEAMCYLINDER );
write_coord( vecBlastPos[0]);
write_coord( vecBlastPos[1]);
write_coord( vecBlastPos[2] - 16);
write_coord( vecBlastPos[0]);
write_coord( vecBlastPos[1]);
write_coord( vecBlastPos[2] - 16 + BLAST_RADIUS / 2);
write_short( g_spriteShockwave );
write_byte( 0 ); // Startframe
write_byte( 0 ); // Framerate
write_byte( 6 ); // Life
write_byte( 16 ); // Width
write_byte( 0 ); // Noise
write_byte( 188 );
write_byte( 220 );
write_byte( 255 );
write_byte( 255 ); // Brightness
write_byte( 0 ); // Speed
message_end();

return PLUGIN_CONTINUE;
}

public Implosion(vecImplosionPos[3])
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_IMPLOSION );
write_coord(vecImplosionPos[0]);
write_coord(vecImplosionPos[1]);
write_coord(vecImplosionPos[2]);
write_byte(100);
write_byte(20);
write_byte(5);
message_end();

return PLUGIN_CONTINUE;
}

CastIceImplosion(iCasterID)
{
// new vecTarget[3];
new iTargetID, iBodyPartID;
get_user_aiming(iCasterID, iTargetID, iBodyPartID);

// bmgeneralfunc.inc IsFriendlyFireOn function
new bool:bFF = IsFriendlyFireOn();

if ( iTargetID > 0 && iTargetID <= 32 )
{
if (!bFF)
if ( get_user_team(iCasterID) == get_user_team(iTargetID) )
return PLUGIN_CONTINUE;

new args[4];
args[0] = iCasterID;
args[1] = iTargetID;
args[2] = ICE_IMPLOSION_TURNS;
args[3] = g_iArrPlSelMagicPower[iCasterID];

if ( file_exists("sound/battlemages/coldwind.wav") )
emit_sound(iCasterID, CHAN_ITEM, "battlemages/coldwind.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

set_user_maxspeed(iTargetID, ICE_IMPLOSION_SLOW_SPEED);
g_bArrPlayersIsSlowed[iTargetID] = true;

IceImplosionEffect(iTargetID);

// bmgeneralfunc.inc DoDamage function
DoDamage(iTargetID, iCasterID, g_iArrPlSelMagicPower[iCasterID], DMG_CAUSE_ICE_IMPLOSION);

set_task(ICE_IMPLOSION_INTERVAL, "IceImplosionDOT", ICE_IMPLOSION_DOT_TASK_ID + iCasterID, args, 4);
}
return PLUGIN_HANDLED;
}

public IceImplosionDOT(args[])
{
new iCasterID = args[0];
new iTargetID = args[1];

if ( is_user_alive(iTargetID) )
{
IceImplosionEffect(iTargetID);

// bmgeneralfunc.inc DoDamage function
DoDamage(iTargetID, iCasterID, args[3], DMG_CAUSE_ICE_IMPLOSION);

if (--args[2] > 0)
set_task(ICE_IMPLOSION_INTERVAL, "IceImplosionDOT", ICE_IMPLOSION_DOT_TASK_ID + iCasterID, args, 4);
else
{
if (g_bArrPlayersIsHasted[iTargetID])
set_user_maxspeed(iTargetID, float(LIGHTNING_SPEED_POWER));
else
{
// bmgeneralfuncs.inc ResetMaxSpeed function
ResetMaxSpeed(iTargetID);
}
}
}
else
{
// bmgeneralfuncs.inc ResetMaxSpeed function
ResetMaxSpeed(iTargetID);
}

return PLUGIN_CONTINUE;
}

IceImplosionEffect(iTargetID)
{
new vecImplosionPos[3];
get_user_origin(iTargetID, vecImplosionPos);
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_IMPLOSION );
write_coord(vecImplosionPos[0]);
write_coord(vecImplosionPos[1]);
write_coord(vecImplosionPos[2]);
write_byte(100);
write_byte(20);
write_byte(5);
message_end();
}

CastMagmaShield(iCasterID)
{
set_user_health(iCasterID, get_user_health(iCasterID) + ABNORMAL_HEALTH);
g_bArrPlayersHasMagmaShield[iCasterID] = true;

if ( file_exists("sound/battlemages/fireball.wav") )
emit_sound(iCasterID, CHAN_ITEM, "battlemages/fireball.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

// Adds a red aura indicating that this player is using Magma shield.
set_user_rendering(iCasterID, kRenderFxGlowShell, 255, 25, 25, kRenderTransAlpha, 255);

return PLUGIN_HANDLED;
}

AttackOnMagmaShield(iCasterID, iAttackerID, iDamage, iBodyPartID, iWeaponID)
{
set_user_health(iCasterID, get_user_health(iCasterID) + floatround( float(iDamage) * MAGMA_SHIELD_POWER )); // Reduce damage

if ( iCasterID != iAttackerID )
DoDamage(iAttackerID, iCasterID, floatround( float(iDamage) * MAGMA_SHIELD_MIRROR_DMG ), DMG_CAUSE_MAGMA_SHIELD);

if ( get_user_health(iCasterID) < ABNORMAL_HEALTH + 1 )
{
new iHeadShot = 0;
if ( iBodyPartID == HIT_HEAD )
iHeadShot = 1;

DoDamage(iCasterID, iAttackerID, ABNORMAL_HEALTH + 1, iWeaponID, true, iHeadShot);
}
}

#endif

//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* bmenergy.inc *
//* *
//********************************************* ******************

#if !defined BATTLE_MAGES_ENERGY_MAGIC
#define BATTLE_MAGES_ENERGY_MAGIC

#include "bmconst"
#include "bmgvars"
#include "bmgeneralfuncs"

CastLightningStrike(iPlayerID)
{
// bmgeneralfunc.inc IsFriendlyFireOn function
new bool:bFF = IsFriendlyFireOn();

new iEnemyID, iBodyPart;
new iLinewidth = 50;
new vecTarget[3];
new vecCaster[3];

get_user_origin(iPlayerID, vecCaster);
get_user_aiming(iPlayerID, iEnemyID, iBodyPart);

// if aimed on a player...
if ( iEnemyID > 0 && iEnemyID <= 32 )
{
if (!bFF)
if ( get_user_team(iPlayerID) == get_user_team(iEnemyID) )
return PLUGIN_CONTINUE;

get_user_origin(iEnemyID, vecTarget);

LightningEffect(vecCaster, vecTarget, iLinewidth, iPlayerID);

// bmgeneralfunc.inc DoDamage function
DoDamage(iEnemyID, iPlayerID, g_iArrPlSelMagicPower[iPlayerID], DMG_CAUSE_LIGHTNING_STRIKE);
}
else
{
get_user_origin(iPlayerID, vecTarget, 3);

LightningEffect(vecCaster, vecTarget, iLinewidth, iPlayerID);
}
return PLUGIN_CONTINUE;
}

public LightningEffect(vecCaster[], vecTarget[], iLinewidth, iCasterID)
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_BEAMPOINTS );

// Start Position
write_coord(vecCaster[0]);
write_coord(vecCaster[1]);
write_coord(vecCaster[2]);

// End Position
write_coord(vecTarget[0]);
write_coord(vecTarget[1]);
write_coord(vecTarget[2]);

write_short( g_spriteLightning );
write_byte( 0 ); // Starting frame
write_byte( 15 ); // Frame rate
write_byte( 5 ); // Life
write_byte( iLinewidth ); // Line width
write_byte( 10 ); // Noise amplitude
write_byte( 255 ); // Red color
write_byte( 255 ); // Green color
write_byte( 255 ); // Blue color
write_byte( 255 ); // Brightness
write_byte( 0 ); // Scroll speed
message_end();

if ( file_exists("sound/battlemages/lightningbolt.wav") )
emit_sound(iCasterID, CHAN_ITEM, "battlemages/lightningbolt.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

return PLUGIN_CONTINUE;
}

CastLightningSpeed(iCasterID)
{
set_user_maxspeed(iCasterID, float(g_iArrPlSelMagicPower[iCasterID]));
new args[1];
args[0] = iCasterID;

if ( file_exists("sound/battlemages/thunder_speed.wav") )
emit_sound(iCasterID, CHAN_ITEM, "battlemages/thunder_speed.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

message_begin( MSG_ONE, 108, {0,0,0}, iCasterID );
write_byte( LIGHTNING_SPEED_DURATION ); // duration
write_byte( 0 ); // duration
message_end();

set_task(float(LIGHTNING_SPEED_DURATION), "EndLightningSpeed", LIGHTNING_SPEED_TASK_ID + iCasterID, args, 1);
return PLUGIN_HANDLED;
}

public EndLightningSpeed(args[])
{
new iCasterID = args[0];

if ( !g_bArrPlayersIsSlowed[iCasterID] )
{
// bmgeneralfuncs.inc ResetMaxSpeed function
ResetMaxSpeed(iCasterID);
}

return PLUGIN_CONTINUE;
}

CastPlanarArmor(iCasterID)
{
set_user_armor(iCasterID, PLANAR_ARMOR_POWER);

if ( file_exists("sound/battlemages/planar_armor.wav") )
emit_sound(iCasterID, CHAN_ITEM, "battlemages/planar_armor.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

// Adds a blue aura indicating that this player is using Planar armor.
set_user_rendering(iCasterID, kRenderFxGlowShell, 25, 25, 255, kRenderTransAlpha, 255);

return PLUGIN_HANDLED;
}

#endif

//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* bmgeneralfuncs.inc *
//* *
//********************************************* ******************

#if !defined BATTLE_MAGES_GENERAL_FUNCTIONS
#define BATTLE_MAGES_GENERAL_FUNCTIONS

#include "bmconst"

bool:IsFriendlyFireOn()
{
if(cvar_exists("mp_friendlyfire"))
{
new iFF = get_cvar_num("mp_friendlyfire");
return (iFF == 1);
}
else
return false;

return false; // Not really needed, but I hate warnings from the compiler
}

stock LogKill(iShooterID, iTargetID, sWeaponDescription[] )
{
new sShooterName[24],sTargetName[24], sShooterAuthID[20], sTargetAuthID[20], sShooterTeamName[8], sTargetTeamName[8];

// Info on Shooter
get_user_name(iShooterID, sShooterName, 23);
get_user_team(iShooterID, sShooterTeamName, 7);
get_user_authid(iShooterID, sShooterAuthID, 19);

// Info on Target
get_user_name(iTargetID, sTargetName, 23);
get_user_team(iTargetID, sTargetTeamName, 7);
get_user_authid(iTargetID, sTargetAuthID, 19);

// Log this Kill
log_message("\"%s<%d><%s><%s>\" killed \"%s<%d><%s><%s>\" with \"%s\"",
sShooterName, get_user_userid(iShooterID), sShooterAuthID, sShooterTeamName,
sTargetName, get_user_userid(iTargetID), sTargetAuthID, sTargetTeamName, sWeaponDescription );
}

DoDamage(iTargetID, iShooterID, iDamage, iDamageCause, bIsWeaponID = false, iHeadShot = 0)
{
new sWeaponOrMagicName[64];

if ( bIsWeaponID )
{
// get_weaponname(iDamageCause, sWeaponOrMagicName, 63); // Doesnt exist yet...
GetWeaponName(iDamageCause, sWeaponOrMagicName, 63);

if ( iDamageCause == CSW_HEGRENADE )
iHeadShot = 0;
}
else
{
switch( iDamageCause )
{
case DMG_CAUSE_FIREBALL:
sWeaponOrMagicName = "Fireball";
case DMG_CAUSE_LIGHTNING_STRIKE:
sWeaponOrMagicName = "Lightning Strike";
case DMG_CAUSE_ICE_IMPLOSION:
sWeaponOrMagicName = "Ice Implosion";
case DMG_CAUSE_MAGMA_SHIELD:
sWeaponOrMagicName = "Magma Shield";
case DMG_CAUSE_MIND_BLAST:
sWeaponOrMagicName = "Mind Blast";
}
}

new bool:bPlayerDied = false;
new iHP = get_user_health(iTargetID);

if ( ( iHP - iDamage ) <= 0 )
bPlayerDied = true;
else if ( g_bArrPlayersHasMagmaShield[iTargetID] && get_user_health(iTargetID) <= ABNORMAL_HEALTH )
bPlayerDied = true;

if (bPlayerDied)
{
// engine.inc set_msg_block function
set_msg_block(g_iGameMsgDeath, BLOCK_ONCE)
user_kill(iTargetID, DONT_REMOVE_FRAG)
// set_user_health(iTargetID, -1);
}
else
set_user_health(iTargetID, iHP - iDamage);

new sShooterName[32];
get_user_name(iShooterID, sShooterName, 31);

if (bPlayerDied)
{
if ( iShooterID != iTargetID )
{
if ( get_user_team(iShooterID) != get_user_team(iTargetID) )
set_user_frags(iShooterID, get_user_frags(iShooterID) + 1);
else
set_user_frags(iShooterID, get_user_frags(iShooterID) - 1);

// set_user_frags(iTargetID, get_user_frags(iTargetID) + 1);
LogKill(iTargetID, iShooterID, sWeaponOrMagicName);
}

g_bArrPlayersDeathMsgShown[iTargetID] = true;

message_begin( MSG_ALL, g_iGameMsgDeath, {0,0,0}, 0);
write_byte(iShooterID);
write_byte(iTargetID);
write_byte(iHeadShot);
write_string(sWeaponOrMagicName);
message_end();

return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;
}

public SquareRoot(iValue)
{
new iDiv = iValue;
new iResult = 1;

while (iDiv > iResult)
{
iDiv = (iDiv + iResult) / 2;
iResult = iValue / iDiv;
}

return iDiv;
}

public ResetMaxSpeed(iPlayerID)
{
g_bArrPlayersIsHasted[iPlayerID] = false;
g_bArrPlayersIsSlowed[iPlayerID] = false;

new iClipAmmo = 0;
new iAmmo = 0;
new iWeaponID = 0;
iWeaponID = get_user_weapon(iPlayerID, iClipAmmo, iAmmo);

switch ( iWeaponID )
{
case CSW_P228:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_SCOUT:
{
if ( g_bArrPlayersIsZoomMode[iPlayerID] )
set_user_maxspeed(iPlayerID, 220.0);
else
set_user_maxspeed(iPlayerID, 260.0);
}
case CSW_HEGRENADE:
set_user_maxspeed(iPlayerID, 260.0);
case CSW_XM1014:
set_user_maxspeed(iPlayerID, 230.0);
case CSW_C4:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_MAC10:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_AUG:
set_user_maxspeed(iPlayerID, 240.0);
case CSW_SMOKEGRENADE:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_ELITE:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_FIVESEVEN:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_UMP45:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_SG550:
{
if ( g_bArrPlayersIsZoomMode[iPlayerID] )
set_user_maxspeed(iPlayerID, 150.0);
else
set_user_maxspeed(iPlayerID, 210.0);
}
case CSW_GALIL:
set_user_maxspeed(iPlayerID, 240.0);
case CSW_FAMAS:
set_user_maxspeed(iPlayerID, 240.0);
case CSW_USP:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_GLOCK18:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_AWP:
{
if ( g_bArrPlayersIsZoomMode[iPlayerID] )
set_user_maxspeed(iPlayerID, 150.0);
else
set_user_maxspeed(iPlayerID, 210.0);
}
case CSW_MP5NAVY:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_M249:
set_user_maxspeed(iPlayerID, 220.0);
case CSW_M3:
set_user_maxspeed(iPlayerID, 240.0);
case CSW_M4A1:
set_user_maxspeed(iPlayerID, 230.0);
case CSW_TMP:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_G3SG1:
{
if ( g_bArrPlayersIsZoomMode[iPlayerID] )
set_user_maxspeed(iPlayerID, 150.0);
else
set_user_maxspeed(iPlayerID, 210.0);
}
case CSW_FLASHBANG:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_DEAGLE:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_SG552:
set_user_maxspeed(iPlayerID, 235.0);
case CSW_AK47:
set_user_maxspeed(iPlayerID, 221.0);
case CSW_KNIFE:
set_user_maxspeed(iPlayerID, 250.0);
case CSW_P90:
set_user_maxspeed(iPlayerID, 245.0);
}
}

bool:GetWeaponName(iWeaponID, sWeaponName[], iLength)
{
switch ( iWeaponID )
{
case CSW_P228:
format(sWeaponName, iLength, "p228");
case CSW_SCOUT:
format(sWeaponName, iLength, "scout");
case CSW_HEGRENADE:
format(sWeaponName, iLength, "grenade");
case CSW_XM1014:
format(sWeaponName, iLength, "xm1014");
case CSW_C4:
format(sWeaponName, iLength, "c4"); // not entirely sure
case CSW_MAC10:
format(sWeaponName, iLength, "mac10");
case CSW_AUG:
format(sWeaponName, iLength, "aug");
case CSW_SMOKEGRENADE:
format(sWeaponName, iLength, "smokegrenade"); // not entirely sure
case CSW_ELITE:
format(sWeaponName, iLength, "elite");
case CSW_FIVESEVEN:
format(sWeaponName, iLength, "fiveseven");
case CSW_UMP45:
format(sWeaponName, iLength, "ump45");
case CSW_SG550:
format(sWeaponName, iLength, "sg550");
case CSW_GALIL:
format(sWeaponName, iLength, "galil"); // not entirely sure
case CSW_FAMAS:
format(sWeaponName, iLength, "famas"); // not entirely sure
case CSW_USP:
format(sWeaponName, iLength, "usp");
case CSW_GLOCK18:
format(sWeaponName, iLength, "glock18");
case CSW_AWP:
format(sWeaponName, iLength, "awp");
case CSW_MP5NAVY:
format(sWeaponName, iLength, "mp5navy");
case CSW_M249:
format(sWeaponName, iLength, "m249");
case CSW_M3:
format(sWeaponName, iLength, "m3");
case CSW_M4A1:
format(sWeaponName, iLength, "m4a1");
case CSW_TMP:
format(sWeaponName, iLength, "tmp");
case CSW_G3SG1:
format(sWeaponName, iLength, "g3sg1");
case CSW_FLASHBANG:
format(sWeaponName, iLength, "flashbang"); // not entirely sure
case CSW_DEAGLE:
format(sWeaponName, iLength, "deagle");
case CSW_SG552:
format(sWeaponName, iLength, "sg552");
case CSW_AK47:
format(sWeaponName, iLength, "ak47");
case CSW_KNIFE:
format(sWeaponName, iLength, "knife");
case CSW_P90:
format(sWeaponName, iLength, "p90");
default:
{
format(sWeaponName, iLength, ""); // not entirely sure
return false;
}
}
return true;
}

#endif

//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* bmgvars.inc *
//* *
//********************************************* ******************

#if !defined BATTLE_MAGES_GVARS
#define BATTLE_MAGES_GVARS

// Global Variables, Marked by "g_"

// Strings with the names of the diffrent magic schools
new g_sArrMagicSchools[5][] = { "Warrior", "Elemental Mage", "Energy Mage", "Illusion Mage", "Life Mage" };

// Arrays with powers of the diffrent school spells
new g_iArrElementalMagicPowers[] = { FIREBALL_POWER, ICE_IMPLOSION_POWER, NOT_USED };
new g_iArrEnergyMagicPowers[] = { LIGHTNING_STRIKE_POWER, LIGHTNING_SPEED_POWER, NOT_USED };
new g_iArrIllusionMagicPowers[] = { INVISIBILITY_POWER, SHAKING_WORLD_POWER, NOT_USED };
new g_iArrLifeMagicPowers[] = { HEAL_SELF_POWER, HEAL_OTHER_POWER, SHIELD_YLIEN_POWER, NOT_USED };

// Arrays with costs of the diffrent school spells
new g_iArrElementalMagicCost[] = { FIREBALL_COST, ICE_IMPLOSION_COST, MAGMA_SHIELD_COST };
new g_iArrEnergyMagicCost[] = { LIGHTNING_STRIKE_COST, LIGHTNING_SPEED_COST, PLANAR_ARMOR_COST };
new g_iArrIllusionMagicCost[] = { INVISIBILITY_COST, SHAKING_WORLD_COST, MIND_BLAST_COST };
new g_iArrLifeMagicCost[] = { HEAL_SELF_COST, HEAL_OTHER_COST, SHIELD_YLIEN_COST, REGENERATION_COST };

// Arrays with names of the diffrent school spells
new g_sArrElementalMagics[NUMBER_OF_MAGICS_ELEMENTAL][] = { "Fireball", "Ice Implosion", "Magma Shield" };
new g_sArrEnergyMagics[NUMBER_OF_MAGICS_ENERGY][] = { "Lightning Strike", "Lightning Speed", "Planar Armor" };
new g_sArrIllusionMagics[NUMBER_OF_MAGICS_ILLUSION][] = { "Invisibility", "Shaking World", "Mind Blast" };
new g_sArrLifeMagics[NUMBER_OF_MAGICS_LIFE][] = { "Heal Self", "Heal Other", "Shield of Y'lien", "Regeneration" };

// Array with the number of spells in each school
new g_nArrSpellsInSchool[] = { WARRIOR, NUMBER_OF_MAGICS_ELEMENTAL, NUMBER_OF_MAGICS_ENERGY, NUMBER_OF_MAGICS_ILLUSION, NUMBER_OF_MAGICS_LIFE };

// What school the players belongs to
new g_iArrPlayersSchool[33];

// Players Current MP
new g_iArrPlayersMP[33];

// What spell currently selected
new g_iArrPlayersSelMagic[33];

// the power of the selected spell
new g_iArrPlSelMagicPower[33];

// the cost of the selected spell
new g_iArrPlSelMagicCost[33];

// Max hp, so that you cant heal a player over their maxhp
new g_iArrPlayersMaxHP[33];

// Recieves a value if a player wants to change school, 0 as value if they arent changing school
new g_iArrPlayersNextSchool[33];

// The abilities of the current players
//new g_iArrPlAbilities[32][4];

// Booleans
new bool:g_bArrPlayersIsHasted[33] = false;
new bool:g_bArrPlayersIsSlowed[33] = false;
new bool:g_bArrPlayersIsZoomMode[33] = false;
new bool:g_bArrPlayersIsMagicReady[33] = true;
new bool:g_bArrPlayersDeathMsgShown[33] = false;
new bool:g_bArrPlayersHasMagmaShield[33] = false;

// Sprites and messages
new g_spriteBurning, g_spriteLightning, g_spriteShockwave, g_spriteExplosion, g_spriteSmoke;
new g_iGameMsgScrShake, g_iGameMsgDeath;

#endif

//********************************************* ******************
//* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal *
//* *
//* Mod adding magic to the game. *
//* *
//* Copyright (C) 2004, Martin J. Van der Cal *
//* This plugin is under the GNU General Public License, read *
//* "Battle Mages Readme.doc" for further information. *
//* *
//* bmhelp.inc *
//* *
//********************************************* ******************

#if !defined BATTLE_MAGES_HELP
#define BATTLE_MAGES_HELP

public ClCmdHelp(iPlayerID)
{
console_print(iPlayerID, "[BM] <<< Battle Mages - Help >>>");
console_print(iPlayerID, "[BM] Battle Mages introduces magic to cs. To start, you first need to choose a school.");
console_print(iPlayerID, "[BM] Diffrent schools has diffrent magics, a menu in which you can choose a school will");
console_print(iPlayerID, "[BM] appear when it is a new round and if you have yet to choose a school.");
console_print(iPlayerID, "[BM] Now you need to bind a key to be able to cast magic. You do so by typing:");
console_print(iPlayerID, "[BM] bind key bm_castmagic");
console_print(iPlayerID, "[BM] in the console. Where key is the button which you will use to cast magic. Example:");
console_print(iPlayerID, "[BM] bind f bm_castmagic");
console_print(iPlayerID, "[BM] Now, every time you press the f key, you will cast magic.");
console_print(iPlayerID, "[BM] Useful commands to bind:");
console_print(iPlayerID, "[BM] To cast magic:");
console_print(iPlayerID, "[BM] bind key bm_castmagic");
console_print(iPlayerID, "[BM] To choose next magic:");
console_print(iPlayerID, "[BM] bind key bm_nextmagic");
console_print(iPlayerID, "[BM] To choose previous magic:");
console_print(iPlayerID, "[BM] bind key bm_prevmagic");
console_print(iPlayerID, "[BM] To change school:");
console_print(iPlayerID, "[BM] bind key bm_changeschool");
console_print(iPlayerID, "[BM] When you press the bm_changeschool button, you will be able to change school next round.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Type bm_schoolhelp in the console or say chat to display help about the diffrent Schools");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Good Luck");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Forum where you can post your view, suggestions and/or ideas:");
console_print(iPlayerID, "[BM] http://members.lycos.co.uk/ghostwarrior/forum/viewforum.php?f=13&sid=b40fe25fb89a71173f7b0f c00cd04635");
console_print(iPlayerID, "[BM] ");
// console_print(iPlayerID, "[BM] ");
return PLUGIN_HANDLED;
}

public ClCmdSchoolHelp(iPlayerID)
{
console_print(iPlayerID, "[BM] <<< Battle Mages - School Help >>>");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Schools and Magics that are available:");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Elemental Mage - The elemental mage is the master of elements:");
console_print(iPlayerID, "[BM] Fireball - Area Effect Nuke");
console_print(iPlayerID, "[BM] Throws a fireball that will damage everything near it upon impact.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Ice Implosion - Damage over Time with player effect slow");
console_print(iPlayerID, "[BM] Target is assaulted by the coldness of winter.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Magma Shield - Round Buff with reduced damage and mirror damage.");
console_print(iPlayerID, "[BM] The mage become shielded with magma.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Energy Mage - The energy mage is the master of energies:");
console_print(iPlayerID, "[BM] Lightning Strike - Nuke");
console_print(iPlayerID, "[BM] A lightning strikes instantly where the mage point at.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Lightning Speed - Duration Buff with player effect haste.");
console_print(iPlayerID, "[BM] The mage gain the speed of lightning.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Planar Armor - Round Buff");
console_print(iPlayerID, "[BM] The mage becomes enveloped in planar armor.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Illusion Mage - The illusion mage is the master of illusions:");
console_print(iPlayerID, "[BM] Invisibility - Duration Buff with player effect invisibility");
console_print(iPlayerID, "[BM] The mage cloaks himself/herself in an illusion. Disappearing from sight.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Shaking World - Mind Attack with player effect disorientation.");
console_print(iPlayerID, "[BM] An illusion covers the target who thinks the world is shaking.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Mind Blast - Area Effect Damage over Time with player effect disorientation");
console_print(iPlayerID, "[BM] The mage blasts an area with mind power.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Life Mage - The life mage is the master of life:");
console_print(iPlayerID, "[BM] Heal Self - Healing");
console_print(iPlayerID, "[BM] The mage heals himself/herself with 50HP");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Heal Other - Healing");
console_print(iPlayerID, "[BM] The mage heals a teammate with 50HP");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Shield of Y'lien - Round Buff");
console_print(iPlayerID, "[BM] The mage summons a shield, thus receiving 50 more to his max HP.");
console_print(iPlayerID, "[BM] ");
console_print(iPlayerID, "[BM] Regeneration - Duration Buff with player effect regeneration");
console_print(iPlayerID, "[BM] The mage regenerates 5HP/s for a maximum of 100HP.");
console_print(iPlayerID, "[BM] ");
return PLUGIN_HANDLED;
}

DisplayHelp(iPlayerID)
{
new sBattleMagesHelpText[2048];
new iPos = 0;
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "<body bgcolor='#000000' text='#009900'>");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "&lt;&lt;&lt; Battle Mages - Author: Martin J. Van der Cal &gt;&gt;&gt;
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Battle Mages introduces magic to cs. To start, you first need to choose a school.
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Diffrent schools has diffrent magics, a menu in which you can choose a school will
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "appear when it is a new round and if you have yet to choose a school.
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Now you need to bind a key to be able to cast magic. You do so by typing:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_castmagic
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "in the console. Where key is the button which you will use to cast magic. Example:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind f bm_castmagic
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Now, every time you press the f key, you will cast magic.
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Useful commands to bind:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To cast magic:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_castmagic
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To choose next magic:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_nextmagic
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To choose previous magic:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_prevmagic
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To change school:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_changeschool
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "When you press the bm_changeschool button, you will be able to change school next
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "round.
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Type bm_schoolhelp in the console or say chat to display help about the diffrent");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "schools.
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Good Luck
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Forum where you can post your view, suggestions and/or ideas:
");
iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "http://members.lycos.co.uk/ghostwarrior/forum/
");
// iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "");

show_motd(iPlayerID, sBattleMagesHelpText, "Battle Mages - Help");
}

DisplaySchoolHelp(iPlayerID)
{
new sBattleMagesSchoolHelpText[2048];
new iPos = 0;

iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "<body bgcolor='#000000' text='#009900'>");
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "&lt;&lt;&lt; Battle Mages - Author: Martin J. Van der Cal &gt;&gt;&gt;
");
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "
");

switch ( g_iArrPlayersSchool[iPlayerID] )
{
case WARRIOR:
{
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Warriors doesnt wield magic, select a school first.");
// iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "");
}
case ELEMENTAL_MAGE:
{
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Elemental Mage - The elemental mage is the master of elements:

");
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "
");
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Fireball - Area Effect Nuke
");
iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Throws a fireball that explodes upon impact<b
Aarvid is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 03-03-2005 , 14:28  
Reply With Quote #4

maybe you can try this first edit your post above
and use this put the code into that it's way easyer to read
__________________
- Bye bye!
nightscreem is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 03-03-2005 , 15:18  
Reply With Quote #5

Try just posting the acutal .sma
__________________
twistedeuphoria is offline
Aarvid
Junior Member
Join Date: Feb 2005
Old 03-04-2005 , 06:10  
Reply With Quote #6

as i said already the sma file and all the inc files will compile into an amx(x) thats why the code is so long, i posted all the inc files also since theyre needed aswell.

These are the files and the code is written the same order as the files are written here:

• battlemages.sma
• bmconst.inc
• bmelemental.inc
• bmenergy.inc
• bmgeneralfuncs.inc
• bmgvars.inc
• bmhelp.inc
• bmillusion.inc
• bmlife.inc


The sma:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* battlemages.sma                                         * //*                                                             * //*************************************************************** #include <amxmodx> #include <amxmisc> #include <string> #include <fun> #include <engine> #include "effectconst" // Include files to separate code - makes it easier to read. #include "bmconst" #include "bmgvars" #include "bmhelp" // Cast magic functions #include "bmelemental" #include "bmenergy" #include "bmillusion" #include "bmlife" #include "bmgeneralfuncs" public plugin_precache() {     // Precache sprites     g_spriteBurning     = precache_model("sprites/xfire.spr");     g_spriteLightning   = precache_model("sprites/lgtning.spr");     g_spriteShockwave   = precache_model("sprites/shockwave.spr");     g_spriteExplosion   = precache_model("sprites/zerogxplode.spr");     g_spriteSmoke       = precache_model("sprites/steam1.spr");         // Precache Sounds     if (file_exists("sound/battlemages/fireball.wav"))         precache_sound("battlemages/fireball.wav");     if (file_exists("sound/battlemages/cure.wav"))         precache_sound("battlemages/cure.wav");     if ( file_exists("sound/battlemages/lightningbolt.wav") )         precache_sound("battlemages/lightningbolt.wav");     if ( file_exists("sound/battlemages/invisibility.wav") )         precache_sound("battlemages/invisibility.wav");     if ( file_exists("sound/battlemages/earthquake.wav") )         precache_sound("battlemages/earthquake.wav");     if ( file_exists("sound/battlemages/coldwind.wav") )         precache_sound("battlemages/coldwind.wav");     if ( file_exists("sound/battlemages/thunder_speed.wav") )         precache_sound("battlemages/thunder_speed.wav");     if ( file_exists("sound/battlemages/shield.wav") )         precache_sound("battlemages/shield.wav");     if ( file_exists("sound/battlemages/regeneration.wav") )         precache_sound("battlemages/regeneration.wav");     if ( file_exists("sound/battlemages/mind_blast.wav") )         precache_sound("battlemages/mind_blast.wav");     if ( file_exists("sound/battlemages/planar_armor.wav") )         precache_sound("battlemages/planar_armor.wav");         return PLUGIN_CONTINUE; } public plugin_init() {     register_plugin("Battle Mages", "0.1.4", "Van der Cal");     // Magic commands     register_clcmd("bm_castmagic"       , "ClCmdCastMagic");     register_clcmd("bm_nextmagic"       , "ClCmdNextMagic");     register_clcmd("bm_prevmagic"       , "ClCmdPrevMagic");     register_clcmd("bm_changeschool"    , "ClCmdChangeSchool");         // bmhelp.inc ClCmdHelp function     register_clcmd("bm_help"            , "ClCmdHelp");     // bmhelp.inc ClCmdSchoolHelp function     register_clcmd("bm_schoolhelp"      , "ClCmdSchoolHelp");     // Say handler     register_clcmd("say","SayHandler");     register_clcmd("say_team","SayHandler");         // Testing     //register_clcmd("t1", "ClCmdT1");         // Menu Commands     register_menucmd(register_menuid("Select School:"), 1023, "SchoolChoice" );     // Events     register_event("ResetHUD", "NewRound", "b");     register_event("CurWeapon","ChangeWeapon","be","1=1");     register_event("SetFOV","Zoomed","be","1<90");     register_event("SetFOV","Unzoomed","be","1=90");     register_event("Damage", "DamageEvent", "b", "2!0");         // cvars     // Magic Points available at start     register_cvar(CVAR_START_MAGIC_POINTS, "30", FCVAR_SERVER);     // Amount of time(seconds) you have to wait until you can cast magic again     register_cvar(CVAR_MAGIC_COOLDOWN, "15", FCVAR_SERVER);     // Where to position the player information     register_cvar(CVAR_PLAYER_INFO_POSITION, "0", FCVAR_SERVER);         // Get game message id:s     g_iGameMsgScrShake  = get_user_msgid("ScreenShake");     g_iGameMsgDeath     = get_user_msgid("DeathMsg");         // Run config file     new sConfigFilepath[64];     get_customdir(sConfigFilepath, 63);     format(sConfigFilepath, 63, "%s/battlemages/battlemages.cfg", sConfigFilepath);     server_cmd("exec %s",sConfigFilepath);     return PLUGIN_CONTINUE; } //public ClCmdT1(iPlayerID) //{ //  client_print(iPlayerID, print_center, "Current health: %d", get_user_health(iPlayerID)); //  return PLUGIN_HANDLED; //} // Function that will run when a player connects to the server public client_connect(id) {     // Reset values     g_iArrPlayersSchool[id]             = WARRIOR;     g_iArrPlayersMP[id]                 = 0;     g_iArrPlayersSelMagic[id]           = 0;     g_iArrPlSelMagicPower[id]           = 0;     g_iArrPlSelMagicCost[id]            = 0;     g_iArrPlayersMaxHP[id]              = 100;     g_bArrPlayersIsHasted[id]           = false;     g_bArrPlayersIsSlowed[id]           = false;     g_bArrPlayersIsMagicReady[id]       = true;     g_iArrPlayersNextSchool[id]         = DONT_CHANGE_SCHOOL;     g_bArrPlayersIsZoomMode[id]         = false;     g_bArrPlayersDeathMsgShown[id]      = false;     g_bArrPlayersHasMagmaShield[id]     = false; } // Client Command functions public ClCmdCastMagic(iPlayerID) {     if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )     {         client_print(iPlayerID, print_center, "Warriors are not able to wield magic");         return PLUGIN_HANDLED;     }         if ( g_iArrPlayersSchool[iPlayerID] > NUMBER_OF_SCHOOLS )     {         server_print("[BM] ERROR: Player belongs to a school that doesnt exist");         g_iArrPlayersSchool[iPlayerID] = WARRIOR;         return PLUGIN_HANDLED;     }         if ( !g_bArrPlayersIsMagicReady[iPlayerID] )         return PLUGIN_HANDLED;         if ( !is_user_alive(iPlayerID) )         return PLUGIN_HANDLED;         new iSpellID = g_iArrPlayersSelMagic[iPlayerID];     if ( g_iArrPlayersMP[iPlayerID] - g_iArrPlSelMagicCost[iPlayerID] < 0 )     {         client_print(iPlayerID, print_center, "You dont have enough MP to cast the spell");         return PLUGIN_HANDLED;     }     new bool:bCastMagic = false;     new iTargetID, iBodyPartID;     switch ( g_iArrPlayersSchool[iPlayerID] )     {         case ELEMENTAL_MAGE:             {                 switch( iSpellID )                 {                 case FIREBALL:                     {                         bCastMagic = true;                         SpellCooldown(iPlayerID);                         // bmelemental.inc CastFireBall function                         CastFireBall(iPlayerID);                     }                 case ICE_IMPLOSION:                     {                         get_user_aiming(iPlayerID, iTargetID, iBodyPartID);                         if ( iTargetID > 0 && iTargetID <= 32 )                         {                             bCastMagic = true;                             SpellCooldown(iPlayerID);                             // bmelemental.inc CastIceImplosion function                             CastIceImplosion(iPlayerID);                         }                     }                 case MAGMA_SHIELD:                     {                         if ( !g_bArrPlayersHasMagmaShield[iPlayerID] )                         {                             bCastMagic = true;                             SpellCooldown(iPlayerID);                             // bmelemental.inc CastMagmaShield function                             CastMagmaShield(iPlayerID);                         }                     }                 }             }         case ENERGY_MAGE:             {                 switch( iSpellID )                 {                 case LIGHTNING_STRIKE:                     {                         bCastMagic = true;                         SpellCooldown(iPlayerID);                         // bmenergy.inc CastLightningStrike function                         CastLightningStrike(iPlayerID);                     }                 case LIGHTNING_SPEED:                     {                         // if we arent slowed or already hasted.                         if ( !g_bArrPlayersIsSlowed[iPlayerID] && !g_bArrPlayersIsHasted[iPlayerID] )                         {                             bCastMagic = true;                             SpellCooldown(iPlayerID);                             g_bArrPlayersIsHasted[iPlayerID] = true;                             // bmenergy.inc CastLightningSpeed function                             CastLightningSpeed(iPlayerID);                         }                     }                 case PLANAR_ARMOR:                     {                         if ( get_user_armor(iPlayerID) <= 100 )                         {                             bCastMagic = true;                             SpellCooldown(iPlayerID);                             // bmenergy.inc CastPlanarShield function                             CastPlanarArmor(iPlayerID);                         }                     }                 }             }         case ILLUSION_MAGE:             {                 switch( iSpellID )                 {                 case INVISIBILITY:                     {                         SpellCooldown(iPlayerID);                         bCastMagic = true;                         // bmillusion.inc CastInvisibility function                         CastInvisibility(iPlayerID);                     }                 case SHAKING_WORLD:                     {                         // if we are aiming on a player...                         get_user_aiming(iPlayerID, iTargetID, iBodyPartID);                         if ( iTargetID > 0 && iTargetID <= 32 )                         {                             bCastMagic = true;                             SpellCooldown(iPlayerID);                             // bmillusion.inc CastShakingWorld function                             CastShakingWorld(iPlayerID);                         }                     }                 case MIND_BLAST:                     {                         bCastMagic = true;                         SpellCooldown(iPlayerID);                         CastMindBlast(iPlayerID);                     }                 }             }         case LIFE_MAGE:             {                 switch( iSpellID )                 {                 case HEAL_SELF:                     {                         bCastMagic = true;                         SpellCooldown(iPlayerID);                         // bmlife.inc CastHealSelf function                         CastHealSelf(iPlayerID);                     }                 case HEAL_OTHER:                     {                         // if we are aiming on a teammate...                         get_user_aiming(iPlayerID, iTargetID, iBodyPartID);                         if ( iTargetID > 0 && iTargetID <= 32 )                         {                             if ( get_user_team(iPlayerID) == get_user_team(iTargetID) )                             {                                 bCastMagic = true;                                 SpellCooldown(iPlayerID);                                 // bmlife.inc CastHealOther function                                 CastHealOther(iPlayerID);                             }                         }                     }                 case SHIELD_YLIEN:                     {                         // If not already enveloped in the shield of Y'lien...                         if ( g_iArrPlayersMaxHP[iPlayerID] < 101 )                         {                             bCastMagic = true;                             SpellCooldown(iPlayerID);                             // bmlife.inc CastShieldYlien function                             CastShieldYlien(iPlayerID);                         }                     }                 case REGENERATION:                     {                         bCastMagic = true;                         SpellCooldown(iPlayerID);                         // bmlife.inc CastRegeneration function                         CastRegeneration(iPlayerID);                     }                 }             }         default:             {                 return PLUGIN_HANDLED;             }     }     // if we did cast magic     if (bCastMagic)     {         g_iArrPlayersMP[iPlayerID] -= g_iArrPlSelMagicCost[iPlayerID];         DisplayPlayerInfo(iPlayerID);     }     return PLUGIN_HANDLED; } public ClCmdNextMagic(iPlayerID) {     if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )     {         client_print(iPlayerID, print_center, "Warriors are not able to wield magic");         return PLUGIN_HANDLED;     }     if ( g_iArrPlayersSelMagic[iPlayerID] + 1 < g_nArrSpellsInSchool[g_iArrPlayersSchool[iPlayerID]] )         g_iArrPlayersSelMagic[iPlayerID]++;     else         g_iArrPlayersSelMagic[iPlayerID] = 0;         SetSpellSettings(iPlayerID);     DisplayPlayerInfo(iPlayerID);     return PLUGIN_HANDLED; } public ClCmdPrevMagic(iPlayerID) {     if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )     {         client_print(iPlayerID, print_center, "Warriors are not able to wield magic");         return PLUGIN_HANDLED;     }     if ( g_iArrPlayersSelMagic[iPlayerID] > 0 )         g_iArrPlayersSelMagic[iPlayerID]--;     else         g_iArrPlayersSelMagic[iPlayerID] = g_nArrSpellsInSchool[g_iArrPlayersSchool[iPlayerID]] - 1;     SetSpellSettings(iPlayerID);         DisplayPlayerInfo(iPlayerID);     return PLUGIN_HANDLED; } public ClCmdChangeSchool(iPlayerID) {     //g_bArrPlayersSelSchoolPending[iPlayerID] = true;     //console_print(iPlayerID, "[BM] A menu will appear at the start of the next round.");     DisplayChooseSchool(iPlayerID);     return PLUGIN_HANDLED; } public SayHandler(iPlayerID) {     new sSaid[32];     read_args(sSaid,31);     if ( equali(sSaid,"\"/bm_help\"") || equali(sSaid,"\"bm_help\"") || equali(sSaid,"\"/bmhelp\"") || equali(sSaid,"\"bmhelp\"") )         DisplayHelp(iPlayerID); // bmhelp.inc DisplayHelp function     else if ( equali(sSaid,"\"/bm_schoolinfo\"") || equali(sSaid,"\"bm_schoolinfo\"") || equali(sSaid,"\"/bmschoolinfo\"") || equali(sSaid,"\"bmschoolinfo\"") )         DisplaySchoolHelp(iPlayerID); // bmhelp.inc DisplaySchoolHelp function     else if ( equali(sSaid,"\"/bm_schoolhelp\"") || equali(sSaid,"\"bm_schoolhelp\"") || equali(sSaid,"\"/bmschoolhelp\"") || equali(sSaid,"\"bmschoolhelp\"") )         DisplaySchoolHelp(iPlayerID); // bmhelp.inc DisplaySchoolHelp function } // Private functions aiding client command functions SetSpellSettings(iPlayerID) {     switch( g_iArrPlayersSchool[iPlayerID])     {     case ELEMENTAL_MAGE:         {             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrElementalMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrElementalMagicCost[g_iArrPlayersSelMagic[iPlayerID]];         }     case ENERGY_MAGE:         {             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrEnergyMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrEnergyMagicCost[g_iArrPlayersSelMagic[iPlayerID]];         }     case ILLUSION_MAGE:         {             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrIllusionMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrIllusionMagicCost[g_iArrPlayersSelMagic[iPlayerID]];         }     case LIFE_MAGE:         {             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrLifeMagicPowers[g_iArrPlayersSelMagic[iPlayerID]];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrLifeMagicCost[g_iArrPlayersSelMagic[iPlayerID]];         }     } } // Event functions public NewRound(iPlayerID) {     if ( g_iArrPlayersNextSchool[iPlayerID] != DONT_CHANGE_SCHOOL && g_iArrPlayersSchool[iPlayerID] != g_iArrPlayersNextSchool[iPlayerID] )         ChangeSchool(iPlayerID);     else if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )         DisplayChooseSchool(iPlayerID);     RemoveActiveSpells(iPlayerID);         g_bArrPlayersIsZoomMode[iPlayerID]      = false;     g_bArrPlayersDeathMsgShown[iPlayerID]   = false;         return PLUGIN_CONTINUE; } public ChangeWeapon(iPlayerID) {     if ( g_bArrPlayersIsHasted[iPlayerID] )         set_user_maxspeed(iPlayerID, float(LIGHTNING_SPEED_POWER));     else if ( g_bArrPlayersIsSlowed[iPlayerID] )         set_user_maxspeed(iPlayerID, ICE_IMPLOSION_SLOW_SPEED);     return PLUGIN_CONTINUE; } public SchoolChoice(iPlayerID, iSchoolKey) {     if ( iSchoolKey >= 0 && iSchoolKey < NUMBER_OF_SCHOOLS)     {         // Check if the player already belongs to that school         if ( iSchoolKey + 1 != g_iArrPlayersSchool[iPlayerID] )         {             g_iArrPlayersNextSchool[iPlayerID] = iSchoolKey + 1;             if ( g_iArrPlayersSchool[iPlayerID] == WARRIOR )                 ChangeSchool(iPlayerID);             else                 client_print(iPlayerID, print_center, "Your choice has been noted, you will change school next round");         }         else         {             g_iArrPlayersNextSchool[iPlayerID] = DONT_CHANGE_SCHOOL;             client_print(iPlayerID, print_center, "You are part of that school already");         }     }     return PLUGIN_CONTINUE; } public Zoomed(iPlayerID)     g_bArrPlayersIsZoomMode[iPlayerID] = true; public Unzoomed(iPlayerID)     g_bArrPlayersIsZoomMode[iPlayerID] = false; public DamageEvent(iVictimID) {     if ( g_bArrPlayersHasMagmaShield[iVictimID] )     {         new iDamage = read_data(2);         new iAttackerID, iBodyPartID, iWeaponID;         iAttackerID = get_user_attacker(iVictimID, iWeaponID, iBodyPartID);         // bmelemental.inc AttackOnMagmaShield function         AttackOnMagmaShield(iVictimID, iAttackerID, iDamage, iBodyPartID, iWeaponID);     } }     // General Functions RemoveActiveSpells(iPlayerID) {     if ( task_exists(INVISIBILITY_DURATION_TASK_ID + iPlayerID) )   // Removes active Invisibility Spells     {         remove_task(INVISIBILITY_DURATION_TASK_ID + iPlayerID);         set_user_rendering(iPlayerID);     }     if ( task_exists(ICE_IMPLOSION_DOT_TASK_ID + iPlayerID) )   // Removes active Ice Implosion Spells         remove_task(ICE_IMPLOSION_DOT_TASK_ID + iPlayerID);             if ( task_exists(FIREBALL_FLY_TASK_ID + iPlayerID) )    // Removes active Fireball         remove_task(FIREBALL_FLY_TASK_ID + iPlayerID);         if ( task_exists(SPELL_COOLDOWN_TASK_ID + iPlayerID) )  // Removes active spell cooldowns         remove_task(SPELL_COOLDOWN_TASK_ID + iPlayerID);     if ( task_exists(LIGHTNING_SPEED_TASK_ID + iPlayerID) ) // Removes active Lightning Speed Spells         remove_task(LIGHTNING_SPEED_TASK_ID + iPlayerID);     if ( g_bArrPlayersIsSlowed[iPlayerID] || g_bArrPlayersIsHasted[iPlayerID] )     {         // bmgeneralfuncs.inc ResetMaxSpeed function         ResetMaxSpeed(iPlayerID);     }     if ( task_exists(MIND_BLAST_TASK_ID + iPlayerID) )  // Removes active Mind Blast Spells         remove_task(MIND_BLAST_TASK_ID + iPlayerID);     if ( task_exists(REGENERATION_TASK_ID + iPlayerID) )    // Removes active Regeneration Spells         remove_task(REGENERATION_TASK_ID + iPlayerID);         if ( get_user_armor(iPlayerID) > 100 )  // Removes active planar armor spells         set_user_armor(iPlayerID, 100);         if ( g_bArrPlayersHasMagmaShield[iPlayerID] ) // Remove active magma shield spells     {         g_bArrPlayersHasMagmaShield[iPlayerID] = false;     }         set_user_rendering(iPlayerID);     g_iArrPlayersMP[iPlayerID] = get_cvar_num(CVAR_START_MAGIC_POINTS);     g_iArrPlayersMaxHP[iPlayerID] = 100;     g_bArrPlayersIsMagicReady[iPlayerID] = true;     g_bArrPlayersIsHasted[iPlayerID] = false; } public SpellCooldown(iPlayerID) {     g_bArrPlayersIsMagicReady[iPlayerID] = false;     new args[1];     args[0] = iPlayerID;     set_task(float(get_cvar_num(CVAR_MAGIC_COOLDOWN)), "ReadyToCast", SPELL_COOLDOWN_TASK_ID + iPlayerID, args, 1); } public ReadyToCast(args[]) {     g_bArrPlayersIsMagicReady[args[0]] = true;     client_print(args[0], print_center, "You have regained your focus and can cast your next spell."); } ChangeSchool(iPlayerID) {     switch ( g_iArrPlayersNextSchool[iPlayerID] )     {     case ELEMENTAL_MAGE:         {             g_iArrPlayersSchool[iPlayerID]      = ELEMENTAL_MAGE;             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrElementalMagicPowers[INITIAL_SPELL];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrElementalMagicCost[INITIAL_SPELL];         }     case ENERGY_MAGE:         {             g_iArrPlayersSchool[iPlayerID]      = ENERGY_MAGE;             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrEnergyMagicPowers[INITIAL_SPELL];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrEnergyMagicCost[INITIAL_SPELL];         }     case ILLUSION_MAGE:         {             g_iArrPlayersSchool[iPlayerID]      = ILLUSION_MAGE;             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrIllusionMagicPowers[INITIAL_SPELL];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrIllusionMagicCost[INITIAL_SPELL];         }     case LIFE_MAGE:         {             g_iArrPlayersSchool[iPlayerID]      = LIFE_MAGE;             g_iArrPlSelMagicPower[iPlayerID]    = g_iArrLifeMagicPowers[INITIAL_SPELL];             g_iArrPlSelMagicCost[iPlayerID]     = g_iArrLifeMagicCost[INITIAL_SPELL];         }     }     g_bArrPlayersIsMagicReady[iPlayerID] = true;     g_iArrPlayersSelMagic[iPlayerID] = INITIAL_SPELL;     g_iArrPlayersNextSchool[iPlayerID] = DONT_CHANGE_SCHOOL;     DisplayPlayerInfo(iPlayerID); } // Display Functions public DisplayChooseSchool(iPlayerID) {     new sMenu[MAX_MENU_SIZE];     format(sMenu,MAX_MENU_SIZE,"Select School:\n\n1. %s\n2. %s\n3. %s\n4. %s\n9. Exit", g_sArrMagicSchools[ELEMENTAL_MAGE],         g_sArrMagicSchools[ENERGY_MAGE], g_sArrMagicSchools[ILLUSION_MAGE], g_sArrMagicSchools[LIFE_MAGE]);     show_menu(iPlayerID, (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<9), sMenu, -1); } DisplayPlayerInfo(iPlayerID) {     new sActiveSpellName[MAX_CHARS_SPELL_NAME];     switch ( g_iArrPlayersSchool[iPlayerID] )     {     case WARRIOR:           sActiveSpellName = "None";     case ELEMENTAL_MAGE:    format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrElementalMagics[g_iArrPlayersSelMagic[iPlayerID]]);     case ENERGY_MAGE:       format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrEnergyMagics[g_iArrPlayersSelMagic[iPlayerID]]);     case ILLUSION_MAGE:     format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrIllusionMagics[g_iArrPlayersSelMagic[iPlayerID]]);     case LIFE_MAGE:         format(sActiveSpellName, MAX_CHARS_SPELL_NAME - 1, "%s", g_sArrLifeMagics[g_iArrPlayersSelMagic[iPlayerID]]);     }     new iPlayerInfoPosition = get_cvar_num(CVAR_PLAYER_INFO_POSITION);     switch ( iPlayerInfoPosition )     {     case POSITION_DOWN_LEFT:         set_hudmessage(200, 200, 200, -2.0, 0.75, 0, 6.0, 2.0, 0.1, 0.5,HUD_PLAYERINFO);     case POSITION_DOWN_RIGHT:         set_hudmessage(200, 200, 200,  1.0, 0.75, 0, 6.0, 2.0, 0.1, 0.5,HUD_PLAYERINFO)     case POSITION_DOWN_CENTER:         set_hudmessage(200, 200, 200, -1.0, 0.75, 0, 6.0, 2.0, 0.1, 0.5,HUD_PLAYERINFO)     default:         {             server_print("[BM] Error in cvar %s, invalid value", CVAR_PLAYER_INFO_POSITION);             return PLUGIN_CONTINUE;         }     }         show_hudmessage(iPlayerID, "School: %s\nActive Spell: %s, Cost: %dMP\nMP Left: %d",         g_sArrMagicSchools[g_iArrPlayersSchool[iPlayerID]], sActiveSpellName, g_iArrPlSelMagicCost[iPlayerID], g_iArrPlayersMP[iPlayerID]);     return PLUGIN_CONTINUE; }


bmconst.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmconst.inc                                         * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_CONSTANTS #define BATTLE_MAGES_CONSTANTS // General Defines #define MAX_MENU_SIZE           512 #define INITIAL_SPELL           0 #define PLAYER_RADIUS           80 #define MAX_CHARS_SPELL_NAME    20 #define MAX_CHARS_SCHOOL_NAME   32 #define HUD_PLAYERINFO          1 #define DONT_CHANGE_SCHOOL      0 #define DONT_REMOVE_FRAG        1 // for user_kill function #define NOT_USED                0 #define GET_AIM_ENTITY_HIT      3 // For use with get_user_origin, mode 3 #define ABNORMAL_HEALTH         1024 // CVAR names #define CVAR_MAGIC_COOLDOWN         "mp_magicdelay" #define CVAR_START_MAGIC_POINTS     "mp_startmp" #define CVAR_PLAYER_INFO_POSITION   "mp_bmplayerinfopos" // Player info positions #define POSITION_DOWN_LEFT      0 #define POSITION_DOWN_RIGHT     1 #define POSITION_DOWN_CENTER    2 // Task IDs #define SPELL_COOLDOWN_TASK_ID          700 #define INVISIBILITY_DURATION_TASK_ID   735 #define FIREBALL_FLY_TASK_ID            770 #define EXPLOSION_TASK_ID               805 #define ICE_IMPLOSION_DOT_TASK_ID       840 #define LIGHTNING_SPEED_TASK_ID         875 #define SHAKE_WORLD_TASK_ID             910 #define MIND_BLAST_TASK_ID              945 #define REGENERATION_TASK_ID            980 // Magics sorted by school: #define NUMBER_OF_SCHOOLS           4 #define WARRIOR                     0 #define ELEMENTAL_MAGE              1 #define ENERGY_MAGE                 2 #define ILLUSION_MAGE               3 #define LIFE_MAGE                   4 // Elemental Magics #define NUMBER_OF_MAGICS_ELEMENTAL  3 // Name of spell                    Type of spell // Fireball                         AE Nuke #define FIREBALL                    0 #define FIREBALL_POWER              25 // times 3 area damage #define FIREBALL_COST               7 #define FIREBALL_SPEED              80 #define FIREBALL_SIZE               20 #define NUMBER_LOOPS                3 #define EXPLOSION_RANGE             300 #define BLAST_RADIUS                250 // Ice Implosion                    DoT + Slow #define ICE_IMPLOSION               1 #define ICE_IMPLOSION_POWER         5 #define ICE_IMPLOSION_COST          7 #define ICE_IMPLOSION_DURATION      60 #define ICE_IMPLOSION_TURNS         5 #define ICE_IMPLOSION_INTERVAL      2.0 #define ICE_IMPLOSION_SLOW_SPEED    125.0 // Magma Shield                     Round Buff #define MAGMA_SHIELD                2 #define MAGMA_SHIELD_POWER          0.25 // % #define MAGMA_SHIELD_COST           10 #define MAGMA_SHIELD_MIRROR_DMG     0.10 // % // Energy Magics #define NUMBER_OF_MAGICS_ENERGY     3 // Lightning Strike                 Nuke #define LIGHTNING_STRIKE            0 #define LIGHTNING_STRIKE_POWER      50 #define LIGHTNING_STRIKE_COST       5 // Lightning Speed                  Duration Buff #define LIGHTNING_SPEED             1 #define LIGHTNING_SPEED_POWER       330 #define LIGHTNING_SPEED_COST        10 #define LIGHTNING_SPEED_DURATION    30 // Planar Shield                    Round Buff #define PLANAR_ARMOR                2 #define PLANAR_ARMOR_POWER          200 #define PLANAR_ARMOR_COST           10 // Leech                            Self Heal + DoT // ONLY AN IDEA SO FAR #define LEECH                       3 #define LEECH_POWER                 10 #define LEECH_COST                  10 #define LEECH_DURATION              30.0 #define LEECH_INTERVALS             2 // Illusion Magics #define NUMBER_OF_MAGICS_ILLUSION   3 // Invisibility                     Duration Buff #define INVISIBILITY                0 #define INVISIBILITY_POWER          50 #define INVISIBILITY_COST           10 #define INVISIBILITY_DURATION       30 // Shaking World                    Confusion #define SHAKING_WORLD               1 #define SHAKING_WORLD_POWER         0 // Not used #define SHAKING_WORLD_COST          5 #define SHAKING_WORLD_DURATION      5.0 // Duration / Interval #define SHAKING_WORLD_INTERVALS     2 // 2 intervals are minimum // Mind Blast                       AoE DoT + Confusion #define MIND_BLAST                  2 #define MIND_BLAST_POWER            20 // times 2 area damage #define MIND_BLAST_COST             10 #define MIND_BLAST_DURATION         5.0 // Duration / Interval #define MIND_BLAST_INTERVALS        2 // 2 intervals are minimum #define MIND_BLAST_RANGE            300 // Life Magics #define NUMBER_OF_MAGICS_LIFE       4 // Heal Self                        Healing #define HEAL_SELF                   0 #define HEAL_SELF_POWER             50 #define HEAL_SELF_COST              6 // Heal Other                       Healing #define HEAL_OTHER                  1 #define HEAL_OTHER_POWER            50 #define HEAL_OTHER_COST             6 // Shield of Y'lien                 Round Buff #define SHIELD_YLIEN                2 #define SHIELD_YLIEN_POWER          50 #define SHIELD_YLIEN_COST           10 // Regeneration                     Healing #define REGENERATION                3 #define REGENERATION_POWER          5 // HP/s #define REGENERATION_COST           10 #define REGENERATION_DURATION       2.0 // Duration / Interval #define REGENERATION_INTERVALS      20 // 1 interval is minimum // // Damage Causes #define DMG_CAUSE_FIREBALL          0 #define DMG_CAUSE_LIGHTNING_STRIKE  1 #define DMG_CAUSE_ICE_IMPLOSION     2 #define DMG_CAUSE_MAGMA_SHIELD      3 #define DMG_CAUSE_MIND_BLAST        4 #endif


bmelemental.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmelemental.inc                                             * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_ELEMENTAL_MAGIC #define BATTLE_MAGES_ELEMENTAL_MAGIC #include "bmconst" #include "bmgvars" #include "bmgeneralfuncs" CastFireBall(iPlayerID) {     new vecTarget[3];     new vecStep[3];     new vecOrigin[3]; //  new float:fVecNewOrigin[3]; //  new float:fVecHit[3]; //  new float:fVecNewTarget[3];     new args[11];     new iDistance;     new nSteps;     get_user_origin(iPlayerID, vecOrigin);     get_user_origin(iPlayerID, vecTarget, GET_AIM_ENTITY_HIT); /*  new iEntityID; //  new iCount = 1;     fVecNewOrigin[0] = float(vecOrigin[0]);     fVecNewOrigin[1] = float(vecOrigin[1]);     fVecNewOrigin[2] = float(vecOrigin[2]);     fVecNewTarget[0] = float(vecTarget[0]);     fVecNewTarget[1] = float(vecTarget[1]);     fVecNewTarget[2] = float(vecTarget[2]);     iEntityID = trace_line(iPlayerID, fVecNewOrigin, fVecNewTarget, fVecHit);     client_print(0, print_center, "EntityID: %d, playerid: %d", iEntityID, iPlayerID); */ /*     while ( iEntityID <= 32 && iEntityID > 0 && iCount < 33)     {         fVecNewOrigin[0] = fVecNewTarget[0];         fVecNewOrigin[1] = fVecNewTarget[1];         fVecNewOrigin[2] = fVecNewTarget[2];         fVecNewTarget[0] = fVecHit[0];         fVecNewTarget[1] = fVecHit[1];         fVecNewTarget[2] = fVecHit[2];         iEntityID = trace_line(iEntityID, fVecNewOrigin, fVecNewTarget, fVecHit);         iCount++;     }     iDistance = get_distance(vecOrigin, fVecHit); */     iDistance = get_distance(vecOrigin, vecTarget);     nSteps = iDistance / FIREBALL_SPEED; //  vecStep[0] = (floatround(fVecHit[0]) - vecOrigin[0]) / nSteps; //  vecStep[1] = (floatround(fVecHit[1]) - vecOrigin[1]) / nSteps; //  vecStep[2] = (floatround(fVecHit[2]) - vecOrigin[2]) / nSteps;     vecStep[0] = (vecTarget[0] - vecOrigin[0]) / nSteps;     vecStep[1] = (vecTarget[1] - vecOrigin[1]) / nSteps;     vecStep[2] = (vecTarget[2] - vecOrigin[2]) / nSteps; //  args[0] = floatround(fVecHit[0]); //  args[1] = floatround(fVecHit[1]); //  args[2] = floatround(fVecHit[2]);     args[0]     = vecTarget[0];     args[1]     = vecTarget[1];     args[2]     = vecTarget[2];     args[3]     = iPlayerID;     args[4]     = vecStep[0];     args[5]     = vecStep[1];     args[6]     = vecStep[2];     args[7]     = vecOrigin[0];     args[8]     = vecOrigin[1];     args[9]     = vecOrigin[2];     args[10]    = g_iArrPlSelMagicPower[iPlayerID];     if ( file_exists("sound/battlemages/fireball.wav") )         emit_sound(iPlayerID, CHAN_ITEM, "battlemages/fireball.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);         set_task(0.1, "FireBallFly", FIREBALL_FLY_TASK_ID + iPlayerID, args, 11);     return PLUGIN_HANDLED; } public FireBallFly(args[]) {     new vecTarget[3];     vecTarget[0] = args[0];     vecTarget[1] = args[1];     vecTarget[2] = args[2];     new iCasterID = args[3];     new vecStep[3];     vecStep[0] = args[4];     vecStep[1] = args[5];     vecStep[2] = args[6];     new vecPos[3];     vecPos[0] = args[7];     vecPos[1] = args[8];     vecPos[2] = args[9];     vecPos[0] += vecStep[0];     vecPos[1] += vecStep[1];     vecPos[2] += vecStep[2];     if ( get_distance(vecTarget, vecPos) < PLAYER_RADIUS )     {         Explosion(vecTarget, iCasterID, args[10]);         return PLUGIN_CONTINUE;     }     new iArrPlayersID[32];     new nPlayers;     get_players(iArrPlayersID, nPlayers, "a");     new vecPlayerPos[3];     for (new iPlayer=0; iPlayer < nPlayers; iPlayer++)     {         if ( iArrPlayersID[iPlayer] != iCasterID )         {             get_user_origin(iArrPlayersID[iPlayer], vecPlayerPos);             if ( get_distance(vecPlayerPos, vecPos) < PLAYER_RADIUS )             {                 Explosion(vecPlayerPos, iCasterID, args[10]);                 return PLUGIN_CONTINUE;             }         }     }     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte( TE_SPRITE );     write_coord(vecPos[0] - ( vecStep[0] / 3 * 2 ));     write_coord(vecPos[1] - ( vecStep[1] / 3 * 2 ));     write_coord(vecPos[2] - ( vecStep[2] / 3 * 2 ));     write_short( g_spriteBurning );     write_byte( FIREBALL_SIZE );     write_byte( 200 );     message_end();     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte( TE_SPRITE );     write_coord(vecPos[0] - ( vecStep[0] / 3 ));     write_coord(vecPos[1] - ( vecStep[1] / 3 ));     write_coord(vecPos[2] - ( vecStep[2] / 3 ));     write_short( g_spriteBurning );     write_byte( FIREBALL_SIZE );     write_byte( 200 );     message_end();     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte( TE_SPRITE );     write_coord(vecPos[0]);     write_coord(vecPos[1]);     write_coord(vecPos[2]);     write_short( g_spriteBurning );     write_byte( FIREBALL_SIZE );     write_byte( 200 );     message_end();     args[7] = vecPos[0];     args[8] = vecPos[1];     args[9] = vecPos[2];     set_task(0.1, "FireBallFly", FIREBALL_FLY_TASK_ID + iCasterID, args, 11);     return PLUGIN_CONTINUE; } Explosion(vecOrigin[], iCasterID, iDamage) {     new args[6];         args[0] = vecOrigin[0];     args[1] = vecOrigin[1];     args[2] = vecOrigin[2];     args[3] = iCasterID;     args[4] = NUMBER_LOOPS;     args[5] = iDamage;         set_task(0.1, "Implosion", 1, vecOrigin, 3);     set_task(0.2, "Explode", EXPLOSION_TASK_ID + iCasterID, args, 6);     set_task(0.3, "BlastCircles", 2, vecOrigin, 3);         return PLUGIN_CONTINUE; } public Explode(args[]) {     new iCasterID = args[3];     new vecBlastPos[3];     vecBlastPos[0] = args[0];     vecBlastPos[1] = args[1];     vecBlastPos[2] = args[2];         message_begin( MSG_PVS, SVC_TEMPENTITY, vecBlastPos );     write_byte( TE_EXPLOSION);     write_coord( vecBlastPos[0] + random_num( -100, 100 ));     write_coord( vecBlastPos[1] + random_num( -100, 100 ));     write_coord( vecBlastPos[2] + random_num( -50, 50 ));     write_short( g_spriteExplosion );     write_byte( random_num(0, 20) + 20  );     write_byte( 12  );     write_byte( TE_EXPLFLAG_NONE );     message_end();     message_begin( MSG_PVS, SVC_TEMPENTITY, vecBlastPos );     write_byte( TE_SMOKE );     write_coord( vecBlastPos[0] + random_num( -100, 100 ));     write_coord( vecBlastPos[1] + random_num( -100, 100 ));     write_coord( vecBlastPos[2] + random_num( -50, 50 ));     write_short( g_spriteSmoke );     write_byte( 60 );     write_byte( 10  );     message_end();     new iArrPlayersID[32];     new nPlayers;     get_players(iArrPlayersID, nPlayers, "a");     new iTargetID;     new iDistanceBetween;     new vecTargetOrigin[3];     new iDamage;     new iMultiplier;     // bmgeneralfunc.inc IsFriendlyFireOn function     new bool:bFF = IsFriendlyFireOn();     for (new iPlayer = 0; iPlayer < nPlayers; iPlayer++)     {         iTargetID = iArrPlayersID[iPlayer];         get_user_origin(iTargetID, vecTargetOrigin);         iDistanceBetween = get_distance(vecBlastPos, vecTargetOrigin);                 if ( get_user_team(iCasterID) != get_user_team(iTargetID) || iCasterID == iTargetID || bFF)         {             if ( iDistanceBetween < EXPLOSION_RANGE )             {                 iMultiplier = args[5] * args[5] / EXPLOSION_RANGE;                 // bmgeneralfunc.inc SquareRoot function                 iDamage = SquareRoot((EXPLOSION_RANGE - iDistanceBetween) * iMultiplier);                 //  RadiusDamage(fVecOrigin, 1, 1);                 // bmgeneralfunc.inc DoDamage function                 DoDamage(iTargetID, iCasterID, iDamage, DMG_CAUSE_FIREBALL);             }         }         if (iDistanceBetween < EXPLOSION_RANGE)         {             message_begin(MSG_ONE, g_iGameMsgScrShake, {0,0,0}, iTargetID);             write_short( 1<<14 );   // Amplitude             write_short( 1<<13 );   // Duration             write_short( 1<<14 );   // Frequency             message_end();         }     }     if (--args[4] > 0)         set_task(0.1, "Explode", EXPLOSION_TASK_ID + iCasterID, args, 6);         return PLUGIN_CONTINUE; } public BlastCircles(vecBlastPos[3]) {     // Blast Circles     message_begin( MSG_PAS, SVC_TEMPENTITY, vecBlastPos );     write_byte( TE_BEAMCYLINDER );     write_coord( vecBlastPos[0]);     write_coord( vecBlastPos[1]);     write_coord( vecBlastPos[2] - 16);     write_coord( vecBlastPos[0]);     write_coord( vecBlastPos[1]);     write_coord( vecBlastPos[2] - 16 + BLAST_RADIUS);     write_short( g_spriteShockwave );     write_byte( 0 );    // Startframe     write_byte( 0 );    // Framerate     write_byte( 6 );    // Life     write_byte( 16 );   // Width     write_byte( 0 );    // Noise     write_byte( 188 );     write_byte( 220 );     write_byte( 255 );     write_byte( 255 )// Brightness     write_byte( 0 );    // Speed     message_end();     message_begin( MSG_PAS, SVC_TEMPENTITY, vecBlastPos );     write_byte( TE_BEAMCYLINDER );     write_coord( vecBlastPos[0]);     write_coord( vecBlastPos[1]);     write_coord( vecBlastPos[2] - 16);     write_coord( vecBlastPos[0]);     write_coord( vecBlastPos[1]);     write_coord( vecBlastPos[2] - 16 + BLAST_RADIUS / 2);     write_short( g_spriteShockwave );     write_byte( 0 );    // Startframe     write_byte( 0 );    // Framerate     write_byte( 6 );    // Life     write_byte( 16 );   // Width     write_byte( 0 );    // Noise     write_byte( 188 );     write_byte( 220 );     write_byte( 255 );     write_byte( 255 )// Brightness     write_byte( 0 );    // Speed     message_end();     return PLUGIN_CONTINUE; } public Implosion(vecImplosionPos[3]) {     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte( TE_IMPLOSION );     write_coord(vecImplosionPos[0]);     write_coord(vecImplosionPos[1]);     write_coord(vecImplosionPos[2]);     write_byte(100);     write_byte(20);     write_byte(5);     message_end();     return PLUGIN_CONTINUE; } CastIceImplosion(iCasterID) { //  new vecTarget[3];     new iTargetID, iBodyPartID;     get_user_aiming(iCasterID, iTargetID, iBodyPartID);         // bmgeneralfunc.inc IsFriendlyFireOn function     new bool:bFF = IsFriendlyFireOn();     if ( iTargetID > 0 && iTargetID <= 32 )     {         if (!bFF)             if ( get_user_team(iCasterID) == get_user_team(iTargetID) )                 return PLUGIN_CONTINUE;                 new args[4];         args[0] = iCasterID;         args[1] = iTargetID;         args[2] = ICE_IMPLOSION_TURNS;         args[3] = g_iArrPlSelMagicPower[iCasterID];                 if ( file_exists("sound/battlemages/coldwind.wav") )             emit_sound(iCasterID, CHAN_ITEM, "battlemages/coldwind.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);         set_user_maxspeed(iTargetID, ICE_IMPLOSION_SLOW_SPEED);         g_bArrPlayersIsSlowed[iTargetID] = true;         IceImplosionEffect(iTargetID);                 // bmgeneralfunc.inc DoDamage function         DoDamage(iTargetID, iCasterID, g_iArrPlSelMagicPower[iCasterID], DMG_CAUSE_ICE_IMPLOSION);                 set_task(ICE_IMPLOSION_INTERVAL, "IceImplosionDOT", ICE_IMPLOSION_DOT_TASK_ID + iCasterID, args, 4);     }     return PLUGIN_HANDLED; } public IceImplosionDOT(args[]) {     new iCasterID = args[0];     new iTargetID = args[1];         if ( is_user_alive(iTargetID) )     {         IceImplosionEffect(iTargetID);                 // bmgeneralfunc.inc DoDamage function         DoDamage(iTargetID, iCasterID, args[3], DMG_CAUSE_ICE_IMPLOSION);                 if (--args[2] > 0)             set_task(ICE_IMPLOSION_INTERVAL, "IceImplosionDOT", ICE_IMPLOSION_DOT_TASK_ID + iCasterID, args, 4);         else         {             if (g_bArrPlayersIsHasted[iTargetID])                 set_user_maxspeed(iTargetID, float(LIGHTNING_SPEED_POWER));             else             {                 // bmgeneralfuncs.inc ResetMaxSpeed function                 ResetMaxSpeed(iTargetID);             }         }     }     else     {         // bmgeneralfuncs.inc ResetMaxSpeed function         ResetMaxSpeed(iTargetID);     }         return PLUGIN_CONTINUE; } IceImplosionEffect(iTargetID) {     new vecImplosionPos[3];     get_user_origin(iTargetID, vecImplosionPos);     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte( TE_IMPLOSION );     write_coord(vecImplosionPos[0]);     write_coord(vecImplosionPos[1]);     write_coord(vecImplosionPos[2]);     write_byte(100);     write_byte(20);     write_byte(5);     message_end(); } CastMagmaShield(iCasterID) {     set_user_health(iCasterID, get_user_health(iCasterID) + ABNORMAL_HEALTH);     g_bArrPlayersHasMagmaShield[iCasterID] = true;         if ( file_exists("sound/battlemages/fireball.wav") )         emit_sound(iCasterID, CHAN_ITEM, "battlemages/fireball.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);     // Adds a red aura indicating that this player is using Magma shield.     set_user_rendering(iCasterID, kRenderFxGlowShell, 255, 25, 25, kRenderTransAlpha, 255);         return PLUGIN_HANDLED; } AttackOnMagmaShield(iCasterID, iAttackerID, iDamage, iBodyPartID, iWeaponID) {     set_user_health(iCasterID, get_user_health(iCasterID) + floatround( float(iDamage) * MAGMA_SHIELD_POWER )); // Reduce damage     if ( iCasterID != iAttackerID )         DoDamage(iAttackerID, iCasterID, floatround( float(iDamage) * MAGMA_SHIELD_MIRROR_DMG ), DMG_CAUSE_MAGMA_SHIELD);         if ( get_user_health(iCasterID) < ABNORMAL_HEALTH + 1 )     {         new iHeadShot = 0;         if ( iBodyPartID == HIT_HEAD )             iHeadShot = 1;                     DoDamage(iCasterID, iAttackerID, ABNORMAL_HEALTH + 1, iWeaponID, true, iHeadShot);     } } #endif


bmenergy.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmenergy.inc                                            * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_ENERGY_MAGIC #define BATTLE_MAGES_ENERGY_MAGIC #include "bmconst" #include "bmgvars" #include "bmgeneralfuncs" CastLightningStrike(iPlayerID) {     // bmgeneralfunc.inc IsFriendlyFireOn function     new bool:bFF = IsFriendlyFireOn();     new iEnemyID, iBodyPart;     new iLinewidth = 50;     new vecTarget[3];     new vecCaster[3];     get_user_origin(iPlayerID, vecCaster);     get_user_aiming(iPlayerID, iEnemyID, iBodyPart);     // if aimed on a player...     if ( iEnemyID > 0 && iEnemyID <= 32 )     {         if (!bFF)             if ( get_user_team(iPlayerID) == get_user_team(iEnemyID) )                 return PLUGIN_CONTINUE;         get_user_origin(iEnemyID, vecTarget);         LightningEffect(vecCaster, vecTarget, iLinewidth, iPlayerID);         // bmgeneralfunc.inc DoDamage function         DoDamage(iEnemyID, iPlayerID, g_iArrPlSelMagicPower[iPlayerID], DMG_CAUSE_LIGHTNING_STRIKE);     }     else     {         get_user_origin(iPlayerID, vecTarget, 3);         LightningEffect(vecCaster, vecTarget, iLinewidth, iPlayerID);     }     return PLUGIN_CONTINUE; } public LightningEffect(vecCaster[], vecTarget[], iLinewidth, iCasterID) {     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte( TE_BEAMPOINTS );     // Start Position     write_coord(vecCaster[0]);     write_coord(vecCaster[1]);     write_coord(vecCaster[2]);     // End Position     write_coord(vecTarget[0]);     write_coord(vecTarget[1]);     write_coord(vecTarget[2]);     write_short( g_spriteLightning );     write_byte( 0 );            // Starting frame     write_byte( 15 );           // Frame rate     write_byte( 5 );            // Life     write_byte( iLinewidth );   // Line width     write_byte( 10 );           // Noise amplitude     write_byte( 255 );          // Red color     write_byte( 255 );          // Green color     write_byte( 255 );          // Blue color     write_byte( 255 );          // Brightness     write_byte( 0 );            // Scroll speed     message_end();     if ( file_exists("sound/battlemages/lightningbolt.wav") )         emit_sound(iCasterID, CHAN_ITEM, "battlemages/lightningbolt.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);     return PLUGIN_CONTINUE; } CastLightningSpeed(iCasterID) {     set_user_maxspeed(iCasterID, float(g_iArrPlSelMagicPower[iCasterID]));     new args[1];     args[0] = iCasterID;     if ( file_exists("sound/battlemages/thunder_speed.wav") )         emit_sound(iCasterID, CHAN_ITEM, "battlemages/thunder_speed.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);     message_begin( MSG_ONE, 108, {0,0,0}, iCasterID );     write_byte( LIGHTNING_SPEED_DURATION ); // duration     write_byte( 0 );                        // duration     message_end();     set_task(float(LIGHTNING_SPEED_DURATION), "EndLightningSpeed", LIGHTNING_SPEED_TASK_ID + iCasterID, args, 1);     return PLUGIN_HANDLED; } public EndLightningSpeed(args[]) {     new iCasterID = args[0];     if ( !g_bArrPlayersIsSlowed[iCasterID] )     {         // bmgeneralfuncs.inc ResetMaxSpeed function         ResetMaxSpeed(iCasterID);     }     return PLUGIN_CONTINUE; } CastPlanarArmor(iCasterID) {     set_user_armor(iCasterID, PLANAR_ARMOR_POWER);     if ( file_exists("sound/battlemages/planar_armor.wav") )         emit_sound(iCasterID, CHAN_ITEM, "battlemages/planar_armor.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);     // Adds a blue aura indicating that this player is using Planar armor.     set_user_rendering(iCasterID, kRenderFxGlowShell, 25, 25, 255, kRenderTransAlpha, 255);         return PLUGIN_HANDLED; } #endif


bmgeneralfuncs.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmgeneralfuncs.inc                                                  * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_GENERAL_FUNCTIONS #define BATTLE_MAGES_GENERAL_FUNCTIONS #include "bmconst" bool:IsFriendlyFireOn() {     if(cvar_exists("mp_friendlyfire"))     {         new iFF = get_cvar_num("mp_friendlyfire");         return (iFF == 1);     }     else         return false;     return false; // Not really needed, but I hate warnings from the compiler } stock LogKill(iShooterID, iTargetID, sWeaponDescription[] ) {     new sShooterName[24],sTargetName[24], sShooterAuthID[20], sTargetAuthID[20], sShooterTeamName[8], sTargetTeamName[8];         // Info on Shooter     get_user_name(iShooterID, sShooterName, 23);     get_user_team(iShooterID, sShooterTeamName, 7);     get_user_authid(iShooterID, sShooterAuthID, 19);     // Info on Target     get_user_name(iTargetID, sTargetName, 23);     get_user_team(iTargetID, sTargetTeamName, 7);     get_user_authid(iTargetID, sTargetAuthID, 19);       // Log this Kill     log_message("\"%s<%d><%s><%s>\" killed \"%s<%d><%s><%s>\" with \"%s\"",     sShooterName, get_user_userid(iShooterID), sShooterAuthID, sShooterTeamName,     sTargetName, get_user_userid(iTargetID), sTargetAuthID, sTargetTeamName, sWeaponDescription ); } DoDamage(iTargetID, iShooterID, iDamage, iDamageCause, bIsWeaponID = false, iHeadShot = 0) {     new sWeaponOrMagicName[64];     if ( bIsWeaponID )     { //      get_weaponname(iDamageCause, sWeaponOrMagicName, 63); // Doesnt exist yet...         GetWeaponName(iDamageCause, sWeaponOrMagicName, 63);         if ( iDamageCause == CSW_HEGRENADE )             iHeadShot = 0;     }     else     {         switch( iDamageCause )         {         case DMG_CAUSE_FIREBALL:             sWeaponOrMagicName = "Fireball";         case DMG_CAUSE_LIGHTNING_STRIKE:             sWeaponOrMagicName = "Lightning Strike";         case DMG_CAUSE_ICE_IMPLOSION:             sWeaponOrMagicName = "Ice Implosion";         case DMG_CAUSE_MAGMA_SHIELD:             sWeaponOrMagicName = "Magma Shield";         case DMG_CAUSE_MIND_BLAST:             sWeaponOrMagicName = "Mind Blast";         }     }         new bool:bPlayerDied = false;     new iHP = get_user_health(iTargetID);     if ( ( iHP - iDamage ) <= 0 )         bPlayerDied = true;     else if ( g_bArrPlayersHasMagmaShield[iTargetID] && get_user_health(iTargetID) <= ABNORMAL_HEALTH )         bPlayerDied = true;         if (bPlayerDied)     {         // engine.inc set_msg_block function         set_msg_block(g_iGameMsgDeath, BLOCK_ONCE)         user_kill(iTargetID, DONT_REMOVE_FRAG) //      set_user_health(iTargetID, -1);     }     else         set_user_health(iTargetID, iHP - iDamage);         new sShooterName[32];     get_user_name(iShooterID, sShooterName, 31);         if (bPlayerDied)     {         if ( iShooterID != iTargetID )         {             if ( get_user_team(iShooterID) != get_user_team(iTargetID) )                 set_user_frags(iShooterID, get_user_frags(iShooterID) + 1);             else                 set_user_frags(iShooterID, get_user_frags(iShooterID) - 1);             //          set_user_frags(iTargetID, get_user_frags(iTargetID) + 1);             LogKill(iTargetID, iShooterID, sWeaponOrMagicName);         }                 g_bArrPlayersDeathMsgShown[iTargetID] = true;         message_begin( MSG_ALL, g_iGameMsgDeath, {0,0,0}, 0);         write_byte(iShooterID);         write_byte(iTargetID);         write_byte(iHeadShot);         write_string(sWeaponOrMagicName);         message_end();         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; } public SquareRoot(iValue) {     new iDiv = iValue;     new iResult = 1;         while (iDiv > iResult)     {         iDiv = (iDiv + iResult) / 2;         iResult = iValue / iDiv;     }         return iDiv; } public ResetMaxSpeed(iPlayerID) {     g_bArrPlayersIsHasted[iPlayerID] = false;     g_bArrPlayersIsSlowed[iPlayerID] = false;         new iClipAmmo   = 0;     new iAmmo       = 0;     new iWeaponID   = 0;     iWeaponID = get_user_weapon(iPlayerID, iClipAmmo, iAmmo);     switch ( iWeaponID )     {     case CSW_P228:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_SCOUT:         {             if ( g_bArrPlayersIsZoomMode[iPlayerID] )                 set_user_maxspeed(iPlayerID, 220.0);             else                 set_user_maxspeed(iPlayerID, 260.0);         }     case CSW_HEGRENADE:             set_user_maxspeed(iPlayerID, 260.0);     case CSW_XM1014:             set_user_maxspeed(iPlayerID, 230.0);     case CSW_C4:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_MAC10:             set_user_maxspeed(iPlayerID, 250.0);     case CSW_AUG:             set_user_maxspeed(iPlayerID, 240.0);     case CSW_SMOKEGRENADE:             set_user_maxspeed(iPlayerID, 250.0);     case CSW_ELITE:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_FIVESEVEN:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_UMP45:             set_user_maxspeed(iPlayerID, 250.0);     case CSW_SG550:         {             if ( g_bArrPlayersIsZoomMode[iPlayerID] )                 set_user_maxspeed(iPlayerID, 150.0);             else                 set_user_maxspeed(iPlayerID, 210.0);         }     case CSW_GALIL:             set_user_maxspeed(iPlayerID, 240.0);     case CSW_FAMAS:             set_user_maxspeed(iPlayerID, 240.0);     case CSW_USP:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_GLOCK18:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_AWP:         {             if ( g_bArrPlayersIsZoomMode[iPlayerID] )                 set_user_maxspeed(iPlayerID, 150.0);             else                 set_user_maxspeed(iPlayerID, 210.0);         }     case CSW_MP5NAVY:             set_user_maxspeed(iPlayerID, 250.0);     case CSW_M249:             set_user_maxspeed(iPlayerID, 220.0);     case CSW_M3:             set_user_maxspeed(iPlayerID, 240.0);     case CSW_M4A1:             set_user_maxspeed(iPlayerID, 230.0);     case CSW_TMP:             set_user_maxspeed(iPlayerID, 250.0);     case CSW_G3SG1:         {             if ( g_bArrPlayersIsZoomMode[iPlayerID] )                 set_user_maxspeed(iPlayerID, 150.0);             else                 set_user_maxspeed(iPlayerID, 210.0);         }     case CSW_FLASHBANG:             set_user_maxspeed(iPlayerID, 250.0);     case CSW_DEAGLE:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_SG552:             set_user_maxspeed(iPlayerID, 235.0);     case CSW_AK47:             set_user_maxspeed(iPlayerID, 221.0);     case CSW_KNIFE:         set_user_maxspeed(iPlayerID, 250.0);     case CSW_P90:         set_user_maxspeed(iPlayerID, 245.0);     } } bool:GetWeaponName(iWeaponID, sWeaponName[], iLength) {     switch ( iWeaponID )     {     case CSW_P228:         format(sWeaponName, iLength, "p228");     case CSW_SCOUT:         format(sWeaponName, iLength, "scout");     case CSW_HEGRENADE:         format(sWeaponName, iLength, "grenade");     case CSW_XM1014:         format(sWeaponName, iLength, "xm1014");     case CSW_C4:         format(sWeaponName, iLength, "c4"); // not entirely sure     case CSW_MAC10:         format(sWeaponName, iLength, "mac10");     case CSW_AUG:         format(sWeaponName, iLength, "aug");     case CSW_SMOKEGRENADE:         format(sWeaponName, iLength, "smokegrenade"); // not entirely sure     case CSW_ELITE:         format(sWeaponName, iLength, "elite");     case CSW_FIVESEVEN:         format(sWeaponName, iLength, "fiveseven");     case CSW_UMP45:         format(sWeaponName, iLength, "ump45");     case CSW_SG550:         format(sWeaponName, iLength, "sg550");     case CSW_GALIL:         format(sWeaponName, iLength, "galil"); // not entirely sure     case CSW_FAMAS:         format(sWeaponName, iLength, "famas"); // not entirely sure     case CSW_USP:         format(sWeaponName, iLength, "usp");     case CSW_GLOCK18:         format(sWeaponName, iLength, "glock18");     case CSW_AWP:         format(sWeaponName, iLength, "awp");     case CSW_MP5NAVY:         format(sWeaponName, iLength, "mp5navy");     case CSW_M249:         format(sWeaponName, iLength, "m249");     case CSW_M3:         format(sWeaponName, iLength, "m3");     case CSW_M4A1:         format(sWeaponName, iLength, "m4a1");     case CSW_TMP:         format(sWeaponName, iLength, "tmp");     case CSW_G3SG1:         format(sWeaponName, iLength, "g3sg1");     case CSW_FLASHBANG:         format(sWeaponName, iLength, "flashbang"); // not entirely sure     case CSW_DEAGLE:         format(sWeaponName, iLength, "deagle");     case CSW_SG552:         format(sWeaponName, iLength, "sg552");     case CSW_AK47:         format(sWeaponName, iLength, "ak47");     case CSW_KNIFE:         format(sWeaponName, iLength, "knife");     case CSW_P90:         format(sWeaponName, iLength, "p90");     default:         {             format(sWeaponName, iLength, ""); // not entirely sure             return false;         }     }     return true; } #endif

bmgvars:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmgvars.inc                                                 * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_GVARS #define BATTLE_MAGES_GVARS // Global Variables, Marked by "g_" // Strings with the names of the diffrent magic schools new g_sArrMagicSchools[5][] = { "Warrior", "Elemental Mage", "Energy Mage", "Illusion Mage", "Life Mage" }; // Arrays with powers of the diffrent school spells new g_iArrElementalMagicPowers[]    = { FIREBALL_POWER,         ICE_IMPLOSION_POWER,    NOT_USED }; new g_iArrEnergyMagicPowers[]       = { LIGHTNING_STRIKE_POWER, LIGHTNING_SPEED_POWER,  NOT_USED }; new g_iArrIllusionMagicPowers[]     = { INVISIBILITY_POWER,     SHAKING_WORLD_POWER,    NOT_USED }; new g_iArrLifeMagicPowers[]         = { HEAL_SELF_POWER,        HEAL_OTHER_POWER,       SHIELD_YLIEN_POWER, NOT_USED }; // Arrays with costs of the diffrent school spells new g_iArrElementalMagicCost[]      = { FIREBALL_COST,          ICE_IMPLOSION_COST,     MAGMA_SHIELD_COST }; new g_iArrEnergyMagicCost[]         = { LIGHTNING_STRIKE_COST,  LIGHTNING_SPEED_COST,   PLANAR_ARMOR_COST }; new g_iArrIllusionMagicCost[]       = { INVISIBILITY_COST,      SHAKING_WORLD_COST,     MIND_BLAST_COST }; new g_iArrLifeMagicCost[]           = { HEAL_SELF_COST,         HEAL_OTHER_COST,        SHIELD_YLIEN_COST,  REGENERATION_COST }; // Arrays with names of the diffrent school spells new g_sArrElementalMagics[NUMBER_OF_MAGICS_ELEMENTAL][] = { "Fireball",         "Ice Implosion",    "Magma Shield"  }; new g_sArrEnergyMagics[NUMBER_OF_MAGICS_ENERGY][]       = { "Lightning Strike", "Lightning Speed""Planar Armor"  }; new g_sArrIllusionMagics[NUMBER_OF_MAGICS_ILLUSION][]   = { "Invisibility",     "Shaking World",    "Mind Blast"    }; new g_sArrLifeMagics[NUMBER_OF_MAGICS_LIFE][]           = { "Heal Self",        "Heal Other",       "Shield of Y'lien", "Regeneration"  }; // Array with the number of spells in each school new g_nArrSpellsInSchool[] = { WARRIOR, NUMBER_OF_MAGICS_ELEMENTAL, NUMBER_OF_MAGICS_ENERGY, NUMBER_OF_MAGICS_ILLUSION, NUMBER_OF_MAGICS_LIFE }; // What school the players belongs to new g_iArrPlayersSchool[33]; // Players Current MP new g_iArrPlayersMP[33]; // What spell currently selected new g_iArrPlayersSelMagic[33]; // the power of the selected spell new g_iArrPlSelMagicPower[33]; // the cost of the selected spell new g_iArrPlSelMagicCost[33]; // Max hp, so that you cant heal a player over their maxhp new g_iArrPlayersMaxHP[33]; // Recieves a value if a player wants to change school, 0 as value if they arent changing school new g_iArrPlayersNextSchool[33]; // The abilities of the current players //new g_iArrPlAbilities[32][4]; // Booleans new bool:g_bArrPlayersIsHasted[33]          = false; new bool:g_bArrPlayersIsSlowed[33]          = false; new bool:g_bArrPlayersIsZoomMode[33]        = false; new bool:g_bArrPlayersIsMagicReady[33]      = true; new bool:g_bArrPlayersDeathMsgShown[33]     = false; new bool:g_bArrPlayersHasMagmaShield[33]    = false; // Sprites and messages new g_spriteBurning, g_spriteLightning, g_spriteShockwave, g_spriteExplosion, g_spriteSmoke; new g_iGameMsgScrShake, g_iGameMsgDeath; #endif
Aarvid is offline
Aarvid
Junior Member
Join Date: Feb 2005
Old 03-04-2005 , 06:26  
Reply With Quote #7

more code:

bmhelp.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmhelp.inc                                                  * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_HELP #define BATTLE_MAGES_HELP public ClCmdHelp(iPlayerID) {     console_print(iPlayerID, "[BM] <<< Battle Mages - Help >>>");     console_print(iPlayerID, "[BM] Battle Mages introduces magic to cs. To start, you first need to choose a school.");     console_print(iPlayerID, "[BM] Diffrent schools has diffrent magics, a menu in which you can choose a school will");     console_print(iPlayerID, "[BM] appear when it is a new round and if you have yet to choose a school.");     console_print(iPlayerID, "[BM] Now you need to bind a key to be able to cast magic. You do so by typing:");     console_print(iPlayerID, "[BM] bind key bm_castmagic");     console_print(iPlayerID, "[BM] in the console. Where key is the button which you will use to cast magic. Example:");     console_print(iPlayerID, "[BM] bind f bm_castmagic");     console_print(iPlayerID, "[BM] Now, every time you press the f key, you will cast magic.");     console_print(iPlayerID, "[BM] Useful commands to bind:");     console_print(iPlayerID, "[BM] To cast magic:");     console_print(iPlayerID, "[BM] bind key bm_castmagic");     console_print(iPlayerID, "[BM] To choose next magic:");     console_print(iPlayerID, "[BM] bind key bm_nextmagic");     console_print(iPlayerID, "[BM] To choose previous magic:");     console_print(iPlayerID, "[BM] bind key bm_prevmagic");     console_print(iPlayerID, "[BM] To change school:");     console_print(iPlayerID, "[BM] bind key bm_changeschool");     console_print(iPlayerID, "[BM] When you press the bm_changeschool button, you will be able to change school next round.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Type bm_schoolhelp in the console or say chat to display help about the diffrent Schools");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Good Luck");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Forum where you can post your view, suggestions and/or ideas:");     console_print(iPlayerID, "[BM] http://members.lycos.co.uk/ghostwarrior/forum/viewforum.php?f=13&sid=b40fe25fb89a71173f7b0fc00cd04635");     console_print(iPlayerID, "[BM] "); //  console_print(iPlayerID, "[BM] ");     return PLUGIN_HANDLED; } public ClCmdSchoolHelp(iPlayerID) {     console_print(iPlayerID, "[BM] <<< Battle Mages - School Help >>>");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Schools and Magics that are available:");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Elemental Mage - The elemental mage is the master of elements:");     console_print(iPlayerID, "[BM] Fireball - Area Effect Nuke");     console_print(iPlayerID, "[BM] Throws a fireball that will damage everything near it upon impact.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Ice Implosion - Damage over Time with player effect slow");     console_print(iPlayerID, "[BM] Target is assaulted by the coldness of winter.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Magma Shield - Round Buff with reduced damage and mirror damage.");     console_print(iPlayerID, "[BM] The mage become shielded with magma.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Energy Mage - The energy mage is the master of energies:");     console_print(iPlayerID, "[BM] Lightning Strike - Nuke");     console_print(iPlayerID, "[BM] A lightning strikes instantly where the mage point at.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Lightning Speed - Duration Buff with player effect haste.");     console_print(iPlayerID, "[BM] The mage gain the speed of lightning.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Planar Armor - Round Buff");     console_print(iPlayerID, "[BM] The mage becomes enveloped in planar armor.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Illusion Mage - The illusion mage is the master of illusions:");     console_print(iPlayerID, "[BM] Invisibility - Duration Buff with player effect invisibility");     console_print(iPlayerID, "[BM] The mage cloaks himself/herself in an illusion. Disappearing from sight.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Shaking World - Mind Attack with player effect disorientation.");     console_print(iPlayerID, "[BM] An illusion covers the target who thinks the world is shaking.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Mind Blast - Area Effect Damage over Time with player effect disorientation");     console_print(iPlayerID, "[BM] The mage blasts an area with mind power.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Life Mage - The life mage is the master of life:");     console_print(iPlayerID, "[BM] Heal Self - Healing");     console_print(iPlayerID, "[BM] The mage heals himself/herself with 50HP");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Heal Other - Healing");     console_print(iPlayerID, "[BM] The mage heals a teammate with 50HP");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Shield of Y'lien - Round Buff");     console_print(iPlayerID, "[BM] The mage summons a shield, thus receiving 50 more to his max HP.");     console_print(iPlayerID, "[BM] ");     console_print(iPlayerID, "[BM] Regeneration - Duration Buff with player effect regeneration");     console_print(iPlayerID, "[BM] The mage regenerates 5HP/s for a maximum of 100HP.");     console_print(iPlayerID, "[BM] ");     return PLUGIN_HANDLED; } DisplayHelp(iPlayerID) {     new sBattleMagesHelpText[2048];     new iPos = 0;     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "<body bgcolor='#000000' text='#009900'>");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "&lt;&lt;&lt; Battle Mages - Author: Martin J. Van der Cal &gt;&gt;&gt; ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, " ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Battle Mages introduces magic to cs. To start, you first need to choose a school. ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Diffrent schools has diffrent magics, a menu in which you can choose a school will ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "appear when it is a new round and if you have yet to choose a school. ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Now you need to bind a key to be able to cast magic. You do so by typing: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_castmagic ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "in the console. Where key is the button which you will use to cast magic. Example: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind f bm_castmagic ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Now, every time you press the f key, you will cast magic. ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, " ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Useful commands to bind: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To cast magic: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_castmagic ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To choose next magic: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_nextmagic ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To choose previous magic: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_prevmagic ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "To change school: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "bind key bm_changeschool ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "When you press the bm_changeschool button, you will be able to change school next ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "round. ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, " ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Type bm_schoolhelp in the console or say chat to display help about the diffrent");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "schools. ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, " ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Good Luck ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, " ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "Forum where you can post your view, suggestions and/or ideas: ");     iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "http://members.lycos.co.uk/ghostwarrior/forum/ "); //  iPos += format(sBattleMagesHelpText[iPos], 2048-iPos, "");         show_motd(iPlayerID, sBattleMagesHelpText, "Battle Mages - Help"); } DisplaySchoolHelp(iPlayerID) {     new sBattleMagesSchoolHelpText[2048];     new iPos = 0;     iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "<body bgcolor='#000000' text='#009900'>");     iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "&lt;&lt;&lt; Battle Mages - Author: Martin J. Van der Cal &gt;&gt;&gt; ");     iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");     switch ( g_iArrPlayersSchool[iPlayerID] )     {     case WARRIOR:         {             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Warriors doesnt wield magic, select a school first."); //          iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "");         }     case ELEMENTAL_MAGE:         {             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Elemental Mage - The elemental mage is the master of elements: ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Fireball - Area Effect Nuke ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Throws a fireball that explodes upon impact ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Ice Implosion - Damage over Time with player effect slow ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Target is assaulted by the coldness of winter. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Magma Shield - Round Buff with reduced damage and mirror damage ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage become shielded with magma. ");         }     case ENERGY_MAGE:         {             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Energy Mage - The energy mage is the master of energies: ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Lightning Strike - Nuke ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "A lightning strikes instantly where the mage point at. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Lightning Speed - Duration Buff with player effect haste ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage gain the speed of lightning. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Planar Armor - Round Buff ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage becomes enveloped in planar armor. ");         }     case ILLUSION_MAGE:         {             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Illusion Mage - The illusion mage is the master of illusions: ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Invisibility - Duration Buff with player effect invisibility ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage cloaks himself/herself in an illusion. Disappearing from sight. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Shaking World - Mind Attack with player effect disorientation ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "An illusion covers the target who thinks the world is shaking. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Mind Blast - Area Effect Damage over Time with player effect disorientation ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage blasts an area with mind power. ");         }     case LIFE_MAGE:         {             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Life Mage - The life mage is the master of life: ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Heal Self - Healing ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage heals himself/herself with 50HP. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Heal Other - Healing ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage heals a teammate with 50HP. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Shield of Y'lien - Round Buff ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage summons a shield, thus receiving 50 more to his max HP. ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, " ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "Regeneration - Duration Buff with player effect regeneration ");             iPos += format(sBattleMagesSchoolHelpText[iPos], 2048-iPos, "The mage regenerates 5HP/s for a maximum of 100HP. ");         }     default:         return;     }     show_motd(iPlayerID, sBattleMagesSchoolHelpText, "Battle Mages - School Help"); } #endif

bmillusion.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmillusion.inc                                              * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_ILLUSION_MAGIC #define BATTLE_MAGES_ILLUSION_MAGIC #include "bmconst" #include "bmgvars" #include "bmgeneralfuncs" CastInvisibility(iPlayerID) {     set_user_rendering(iPlayerID, kRenderFxNone, 0,0,0, kRenderTransTexture, g_iArrPlSelMagicPower[iPlayerID]);         new args[1];     args[0] = iPlayerID;         message_begin( MSG_ONE, 108, {0,0,0}, iPlayerID );     write_byte( INVISIBILITY_DURATION );    // duration     write_byte( 0 );                        // duration     message_end();     set_task(float(INVISIBILITY_DURATION), "EndInvisibility", INVISIBILITY_DURATION_TASK_ID + iPlayerID, args, 1);     if ( file_exists("sound/battlemages/invisibility.wav") )         emit_sound(iPlayerID, CHAN_ITEM, "battlemages/invisibility.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); } public EndInvisibility(args[]) {     set_user_rendering(args[0]); } CastShakingWorld(iCasterID) {     new iTargetID, iBodyPartID;     get_user_aiming(iCasterID, iTargetID, iBodyPartID);         // bmgeneralfunc.inc IsFriendlyFireOn function     new bool:bFF = IsFriendlyFireOn();     if ( iTargetID > 0 && iTargetID <= 32 )     {         if (!bFF)             if ( get_user_team(iCasterID) == get_user_team(iTargetID) )                 return PLUGIN_CONTINUE;                     if ( file_exists("sound/battlemages/earthquake.wav") )             emit_sound(iCasterID, CHAN_ITEM, "battlemages/earthquake.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);                     message_begin(MSG_ONE, g_iGameMsgScrShake, {0,0,0}, iTargetID);         write_short(255<< 14); //ammount         write_short(10 << 14); //lasts this long         write_short(255<< 14); //frequency         message_end();                 new args[3];         args[0] = iCasterID;         args[1] = iTargetID;         args[2] = SHAKING_WORLD_INTERVALS - 1;                     set_task(SHAKING_WORLD_DURATION, "ContinueShakeWorld", SHAKE_WORLD_TASK_ID + iCasterID, args, 3);     }         return PLUGIN_HANDLED; } public ContinueShakeWorld(args[]) {     message_begin(MSG_ONE, g_iGameMsgScrShake, {0,0,0}, args[1]);     write_short(255<< 14); //ammount     write_short(10 << 14); //lasts this long     write_short(255<< 14); //frequency     message_end();         if (--args[2] > 0)         set_task(SHAKING_WORLD_DURATION, "ContinueShakeWorld", SHAKE_WORLD_TASK_ID + args[0], args, 3);         return PLUGIN_CONTINUE; } CastMindBlast(iCasterID) {     new iVecTarget[3];     get_user_origin(iCasterID, iVecTarget, GET_AIM_ENTITY_HIT);         new nPlayers;     new iArrPlayersID[32];     get_players(iArrPlayersID, nPlayers, "a");     new iTargetID;     new iDistanceBetween;     new iVecTargetOrigin[3];         new bool:bFF = IsFriendlyFireOn();     for (new iPlayer = 0; iPlayer < nPlayers; iPlayer++)     {         iTargetID = iArrPlayersID[iPlayer];         get_user_origin(iTargetID, iVecTargetOrigin);         iDistanceBetween = get_distance(iVecTarget, iVecTargetOrigin);         if ( get_user_team(iCasterID) != get_user_team(iTargetID) || iCasterID == iTargetID || bFF)         {             if ( iDistanceBetween < MIND_BLAST_RANGE )             {                 DoDamage(iTargetID, iCasterID, MIND_BLAST_POWER, DMG_CAUSE_MIND_BLAST);                                 if ( file_exists("sound/battlemages/mind_blast.wav") )                     emit_sound(iCasterID, CHAN_ITEM, "battlemages/mind_blast.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);                 if ( is_user_alive(iTargetID) )                 {                     message_begin(MSG_ONE, g_iGameMsgScrShake, {0,0,0}, iTargetID);                     write_short(255<< 14); //ammount                     write_short(10 << 14); //lasts this long                     write_short(255<< 14); //frequency                     message_end();                                         new args[3];                     args[0] = iCasterID;                     args[1] = iTargetID;                     args[2] = MIND_BLAST_INTERVALS - 1;                     set_task(MIND_BLAST_DURATION, "ContinueMindBlast", MIND_BLAST_TASK_ID + iTargetID, args, 3);                 }             }         }     } } public ContinueMindBlast(args[]) {     new iTargetID = args[1];     new iCasterID = args[0];     if ( !is_user_alive(iTargetID) )         return PLUGIN_CONTINUE;     DoDamage(iTargetID, iCasterID, MIND_BLAST_POWER, DMG_CAUSE_MIND_BLAST);     if ( !is_user_alive(iTargetID) )         return PLUGIN_CONTINUE;     message_begin(MSG_ONE, g_iGameMsgScrShake, {0,0,0}, iTargetID);     write_short(255<< 14); //ammount     write_short(10 << 14); //lasts this long     write_short(255<< 14); //frequency     message_end();         if (--args[2] > 0)         set_task(MIND_BLAST_DURATION, "ContinueMindBlast", MIND_BLAST_TASK_ID + iTargetID, args, 3);         return PLUGIN_CONTINUE; } #endif

bmlife.inc:
Code:
//*************************************************************** //* Battle Mages v. 0.1.4 for AMXX by Martin J. Van der Cal     * //*                                                             * //* Mod adding magic to the game.                               * //*                                                             * //* Copyright (C) 2004, Martin J. Van der Cal                   * //* This plugin is under the GNU General Public License, read   * //* "Battle Mages Readme.doc" for further information.          * //*                                                             * //* bmlife.inc                                                  * //*                                                             * //*************************************************************** #if !defined BATTLE_MAGES_LIFE_MAGIC #define BATTLE_MAGES_LIFE_MAGIC #include "bmconst" #include "bmgvars" CastHealSelf(iPlayerID) {     new iHP = get_user_health(iPlayerID) + g_iArrPlSelMagicPower[iPlayerID];     if ( file_exists("sound/battlemages/cure.wav") )         emit_sound(iPlayerID, CHAN_ITEM, "battlemages/cure.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);         if ( iHP < g_iArrPlayersMaxHP[iPlayerID] )         set_user_health(iPlayerID,  iHP);     else         set_user_health(iPlayerID,  g_iArrPlayersMaxHP[iPlayerID]); } CastHealOther(iCasterID) {     new iTargetID, iBodyPartID;     get_user_aiming(iCasterID, iTargetID, iBodyPartID);         if ( iTargetID > 0 && iTargetID <= 32 )     {         if ( get_user_team(iCasterID) == get_user_team(iTargetID) )         {             new iHP = get_user_health(iTargetID) + g_iArrPlSelMagicPower[iCasterID];                     if ( file_exists("sound/battlemages/cure.wav") )                 emit_sound(iCasterID, CHAN_ITEM, "battlemages/cure.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);                         if ( iHP < g_iArrPlayersMaxHP[iTargetID] )                 set_user_health(iTargetID,  iHP);             else                 set_user_health(iTargetID,  g_iArrPlayersMaxHP[iCasterID]);         }     } } CastShieldYlien(iCasterID) {     if ( file_exists("sound/battlemages/shield.wav") )         emit_sound(iCasterID, CHAN_ITEM, "battlemages/shield.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);             g_iArrPlayersMaxHP[iCasterID] += g_iArrPlSelMagicPower[iCasterID];     set_user_health(iCasterID, get_user_health(iCasterID) + g_iArrPlSelMagicPower[iCasterID]);     // Adds a green aura indicating that this player is using Shield of Y'lien.     set_user_rendering(iCasterID, kRenderFxGlowShell, 25, 255, 25, kRenderTransAlpha, 255); } CastRegeneration(iCasterID) {     if ( file_exists("sound/battlemages/regeneration.wav") )         emit_sound(iCasterID, CHAN_ITEM, "battlemages/regeneration.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);     client_print(iCasterID, print_center, "You are regenerating");     new args[2];     args[0] = iCasterID;     args[1] = REGENERATION_INTERVALS;     set_task(REGENERATION_DURATION, "RegenerationContinue", REGENERATION_TASK_ID + iCasterID, args, 2);     return PLUGIN_HANDLED; } public RegenerationContinue(args[]) {     new iCasterID = args[0];         new iHP = get_user_health(iCasterID) + REGENERATION_POWER;     if ( iHP < g_iArrPlayersMaxHP[iCasterID] )         set_user_health(iCasterID,  iHP);     else         set_user_health(iCasterID,  g_iArrPlayersMaxHP[iCasterID]);     if (--args[1] > 0)         set_task(REGENERATION_DURATION, "RegenerationContinue", REGENERATION_TASK_ID + iCasterID, args, 2);     else         client_print(iCasterID, print_center, "You are no longer regenerating");         return PLUGIN_CONTINUE; } #endif

effectconst.inc:
Code:
// message_begin(MSG_ALL,SVC_TEMPENTITY); // write_byte(/*NUMBER OF TEMP EVENT*/); /* * All of the things that it asks for */ // message_end(); // // temp entity events // #define   TE_BEAMPOINTS      0      // beam effect between two points // coord coord coord (start position) // coord coord coord (end position) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define   TE_BEAMENTPOINT      1      // beam effect between point and entity // short (start entity) // coord coord coord (end position) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define   TE_GUNSHOT         2      // particle effect plus ricochet sound // coord coord coord (position) #define   TE_EXPLOSION      3      // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps // coord coord coord (position) // short (sprite index) // byte (scale in 0.1's) // byte (framerate) // byte (flags) // // The Explosion effect has some flags to control performance/aesthetic features: #define TE_EXPLFLAG_NONE      0   // all flags clear makes default Half-Life explosion #define TE_EXPLFLAG_NOADDITIVE   1   // sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite) #define TE_EXPLFLAG_NODLIGHTS   2   // do not render dynamic lights #define TE_EXPLFLAG_NOSOUND      4   // do not play client explosion sound #define TE_EXPLFLAG_NOPARTICLES   8   // do not draw particles #define   TE_TAREXPLOSION      4      // Quake1 "tarbaby" explosion with sound // coord coord coord (position) #define   TE_SMOKE         5      // alphablend sprite, move vertically 30 pps // coord coord coord (position) // short (sprite index) // byte (scale in 0.1's) // byte (framerate) #define   TE_TRACER         6      // tracer effect from point to point // coord, coord, coord (start) // coord, coord, coord (end) #define   TE_LIGHTNING      7      // TE_BEAMPOINTS with simplified parameters // coord, coord, coord (start) // coord, coord, coord (end) // byte (life in 0.1's) // byte (width in 0.1's) // byte (amplitude in 0.01's) // short (sprite model index) #define   TE_BEAMENTS         8       // short (start entity) // short (end entity) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define   TE_SPARKS         9      // 8 random tracers with gravity, ricochet sprite // coord coord coord (position) #define   TE_LAVASPLASH      10      // Quake1 lava splash // coord coord coord (position) #define   TE_TELEPORT         11      // Quake1 teleport splash // coord coord coord (position) #define TE_EXPLOSION2      12      // Quake1 colormaped (base palette) particle explosion with sound // coord coord coord (position) // byte (starting color) // byte (num colors) #define TE_BSPDECAL         13      // Decal from the .BSP file // coord, coord, coord (x,y,z), decal position (center of texture in world) // short (texture index of precached decal texture name) // short (entity index) // [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity) #define TE_IMPLOSION      14      // tracers moving toward a point // coord, coord, coord (position) // byte (radius) // byte (count) // byte (life in 0.1's) #define TE_SPRITETRAIL      15      // line of moving glow sprites with gravity, fadeout, and collisions // coord, coord, coord (start) // coord, coord, coord (end) // short (sprite index) // byte (count) // byte (life in 0.1's) // byte (scale in 0.1's) // byte (velocity along vector in 10's) // byte (randomness of velocity in 10's) #define TE_BEAM            16      // obsolete #define TE_SPRITE         17      // additive sprite, plays 1 cycle // coord, coord, coord (position) // short (sprite index) // byte (scale in 0.1's) // byte (brightness) #define TE_BEAMSPRITE      18      // A beam with a sprite at the end // coord, coord, coord (start position) // coord, coord, coord (end position) // short (beam sprite index) // short (end sprite index) #define TE_BEAMTORUS      19      // screen aligned beam ring, expands to max radius over lifetime // coord coord coord (center position) // coord coord coord (axis and radius) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_BEAMDISK         20      // disk that expands to max radius over lifetime // coord coord coord (center position) // coord coord coord (axis and radius) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_BEAMCYLINDER      21      // cylinder that expands to max radius over lifetime // coord coord coord (center position) // coord coord coord (axis and radius) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_BEAMFOLLOW      22      // create a line of decaying beam segments until entity stops moving // short (entity:attachment to follow) // short (sprite index) // byte (life in 0.1's) // byte (line width in 0.1's) // byte,byte,byte (color) // byte (brightness) #define TE_GLOWSPRITE      23       // coord, coord, coord (pos) short (model index) byte (scale / 10) #define TE_BEAMRING         24      // connect a beam ring to two entities // short (start entity) // short (end entity) // short (sprite index) // byte (starting frame) // byte (frame rate in 0.1's) // byte (life in 0.1's) // byte (line width in 0.1's) // byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_STREAK_SPLASH   25      // oriented shower of tracers // coord coord coord (start position) // coord coord coord (direction vector) // byte (color) // short (count) // short (base speed) // short (ramdon velocity) #define TE_BEAMHOSE         26      // obsolete #define TE_DLIGHT         27      // dynamic light, effect world, minor entity effect // coord, coord, coord (pos) // byte (radius in 10's) // byte byte byte (color) // byte (brightness) // byte (life in 10's) // byte (decay rate in 10's) #define TE_ELIGHT         28      // point entity light, no world effect // short (entity:attachment to follow) // coord coord coord (initial position) // coord (radius) // byte byte byte (color) // byte (life in 0.1's) // coord (decay rate) #define TE_TEXTMESSAGE      29 // short 1.2.13 x (-1 = center) // short 1.2.13 y (-1 = center) // byte Effect 0 = fade in/fade out          // 1 is flickery credits          // 2 is write out (training room) // 4 bytes r,g,b,a color1   (text color) // 4 bytes r,g,b,a color2   (effect color) // ushort 8.8 fadein time // ushort 8.8  fadeout time // ushort 8.8 hold time // optional ushort 8.8 fxtime   (time the highlight lags behing the leading text in effect 2) // string text message      (512 chars max sz string) #define TE_LINE            30 // coord, coord, coord      startpos // coord, coord, coord      endpos // short life in 0.1 s // 3 bytes r, g, b #define TE_BOX            31 // coord, coord, coord      boxmins // coord, coord, coord      boxmaxs // short life in 0.1 s // 3 bytes r, g, b #define TE_KILLBEAM         99      // kill all beams attached to entity // short (entity) #define TE_LARGEFUNNEL      100 // coord coord coord (funnel position) // short (sprite index) // short (flags) #define   TE_BLOODSTREAM      101      // particle spray // coord coord coord (start position) // coord coord coord (spray vector) // byte (color) // byte (speed) #define   TE_SHOWLINE         102      // line of particles every 5 units, dies in 30 seconds // coord coord coord (start position) // coord coord coord (end position) #define TE_BLOOD         103      // particle spray // coord coord coord (start position) // coord coord coord (spray vector) // byte (color) // byte (speed) #define TE_DECAL         104      // Decal applied to a brush entity (not the world) // coord, coord, coord (x,y,z), decal position (center of texture in world) // byte (texture index of precached decal texture name) // short (entity index) #define TE_FIZZ            105      // create alpha sprites inside of entity, float upwards // short (entity) // short (sprite index) // byte (density) #define TE_MODEL         106      // create a moving model that bounces and makes a sound when it hits // coord, coord, coord (position) // coord, coord, coord (velocity) // angle (initial yaw) // short (model index) // byte (bounce sound type) // byte (life in 0.1's) #define TE_EXPLODEMODEL      107      // spherical shower of models, picks from set // coord, coord, coord (origin) // coord (velocity) // short (model index) // short (count) // byte (life in 0.1's) #define TE_BREAKMODEL      108      // box of models or sprites // coord, coord, coord (position) // coord, coord, coord (size) // coord, coord, coord (velocity) // byte (random velocity in 10's) // short (sprite or model index) // byte (count) // byte (life in 0.1 secs) // byte (flags) #define TE_GUNSHOTDECAL      109      // decal and ricochet sound // coord, coord, coord (position) // short (entity index???) // byte (decal???) #define TE_SPRITE_SPRAY      110      // spay of alpha sprites // coord, coord, coord (position) // coord, coord, coord (velocity) // short (sprite index) // byte (count) // byte (speed) // byte (noise) #define TE_ARMOR_RICOCHET   111      // quick spark sprite, client ricochet sound. // coord, coord, coord (position) // byte (scale in 0.1's) #define TE_PLAYERDECAL      112      // ??? // byte (playerindex) // coord, coord, coord (position) // short (entity???) // byte (decal number???) // [optional] short (model index???) #define TE_BUBBLES         113      // create alpha sprites inside of box, float upwards // coord, coord, coord (min start position) // coord, coord, coord (max start position) // coord (float height) // short (model index) // byte (count) // coord (speed) #define TE_BUBBLETRAIL      114      // create alpha sprites along a line, float upwards // coord, coord, coord (min start position) // coord, coord, coord (max start position) // coord (float height) // short (model index) // byte (count) // coord (speed) #define TE_BLOODSPRITE      115      // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent) // coord, coord, coord (position) // short (sprite1 index) // short (sprite2 index) // byte (color) // byte (scale) #define TE_WORLDDECAL      116      // Decal applied to the world brush // coord, coord, coord (x,y,z), decal position (center of texture in world) // byte (texture index of precached decal texture name) #define TE_WORLDDECALHIGH   117      // Decal (with texture index > 256) applied to world brush // coord, coord, coord (x,y,z), decal position (center of texture in world) // byte (texture index of precached decal texture name - 256) #define TE_DECALHIGH      118      // Same as TE_DECAL, but the texture index was greater than 256 // coord, coord, coord (x,y,z), decal position (center of texture in world) // byte (texture index of precached decal texture name - 256) // short (entity index) #define TE_PROJECTILE      119      // Makes a projectile (like a nail) (this is a high-priority tent) // coord, coord, coord (position) // coord, coord, coord (velocity) // short (modelindex) // byte (life) // byte (owner)  projectile won't collide with owner (if owner == 0, projectile will hit any client). #define TE_SPRAY         120      // Throws a shower of sprites or models // coord, coord, coord (position) // coord, coord, coord (direction) // short (modelindex) // byte (count) // byte (speed) // byte (noise) // byte (rendermode) #define TE_PLAYERSPRITES   121      // sprites emit from a player's bounding box (ONLY use for players!) // byte (playernum) // short (sprite modelindex) // byte (count) // byte (variance) (0 = no variance in size) (10 = 10% variance in size) #define TE_PARTICLEBURST   122      // very similar to lavasplash. // coord (origin) // short (radius) // byte (particle color) // byte (duration * 10) (will be randomized a bit) #define TE_FIREFIELD         123      // makes a field of fire. // coord (origin) // short (radius) (fire is made in a square around origin. -radius, -radius to radius, radius) // short (modelindex) // byte (count) // byte (flags) // byte (duration (in seconds) * 10) (will be randomized a bit) // // to keep network traffic low, this message has associated flags that fit into a byte: #define TEFIRE_FLAG_ALLFLOAT   1 // all sprites will drift upwards as they animate #define TEFIRE_FLAG_SOMEFLOAT   2 // some of the sprites will drift upwards. (50% chance) #define TEFIRE_FLAG_LOOP      4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration. #define TEFIRE_FLAG_ALPHA      8 // if set, sprite is rendered alpha blended at 50% else, opaque #define TEFIRE_FLAG_PLANAR      16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. #define TE_PLAYERATTACHMENT         124 // attaches a TENT to a player (this is a high-priority tent) // byte (entity index of player) // coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset ) // short (model index) // short (life * 10 ); #define TE_KILLPLAYERATTACHMENTS   125 // will expire all TENTS attached to a player. // byte (entity index of player) #define TE_MULTIGUNSHOT            126 // much more compact shotgun message // This message is used to make a client approximate a 'spray' of gunfire. // Any weapon that fires more than one bullet per frame and fires in a bit of a spread is // a good candidate for MULTIGUNSHOT use. (shotguns) // // NOTE: This effect makes the client do traces for each bullet, these client traces ignore //       entities that have studio models.Traces are 4096 long. // // coord (origin) // coord (origin) // coord (origin) // coord (direction) // coord (direction) // coord (direction) // coord (x noise * 100) // coord (y noise * 100) // byte (count) // byte (bullethole decal texture index) #define TE_USERTRACER            127 // larger message than the standard tracer, but allows some customization. // coord (origin) // coord (origin) // coord (origin) // coord (velocity) // coord (velocity) // coord (velocity) // byte ( life * 10 ) // byte ( color ) this is an index into an array of color vectors in the engine. (0 - ) // byte ( length * 10 )
Aarvid is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:18.


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