Code:
/*
* How it works:
* Each round leftover runes are spawned
* On the map, they are boost items.
*
* SAY HELP FOR MORE INFO
*
* Please read the documentation
*
*
* Runes descriptions listed by command "runelist"
* Drop runes by binding a key to "dropitem"
*
*
* RESISTANCE - Doubles life
* STRENGTH - doubles damage you deal for all weapons
* HASTE - doubles walkspeed
* REGENERATION - slowly regenerates life to 150
* VAMPIRISM - Steal a percentage of damage you deal
* HUNTER - Knife instakills, no footsteps, armor regenerates
* DISMAY - Opponents lose life when attacking you
* HEROICS - Every kill boosts your speed, pistols do double damage
* SOUL - When you kill an opponent, your life is set to 100
* INVISIBILITY - active when still with a knife
* SHELL - Gain armor by doing damage
* SEER - Knife allows you to see through opponent's eyes, looking at people slows them down
* PHANTOM - Walk through walls, look at others to become partially invisible
* KINETICS - Knife gives you flight, pistol pushes enemies backwards
*
*
* -------------------------------------
* Version info:
* 1.0, build 170 (major.minor.build)
*
* 1.0.170 : Bugfix for hunter knife kills, and improved heroics vs resistance or dismay
* Shell rune slightly improved
* If this version is bug free, then it will become 1.0FINAL, and
* Any more features added will be added to 1.1 or 2.0
*
* 1.0.169 : added sv_seer_range, 12000 by default, if they go past it, you won't see the line
*
* 1.0.168 : Minor Bug with Phantom not resetting transparency
*
* 1.0.167 : Small adjustment to improve generation on some maps
*
* 1.0.166 : 166 is the same as 162, only it works and has been tested
* (fixed a bug with rune generation)
*
*
* 1.0.162 : Fixed a bug with .161's generator change,
* Squashed possible chance of a bug
* That mighta stopped some runes from spawning
*
* 1.0.161 : Changes to make some maps spawn runes in better areas
* Also, rune removal at endround removed because
* It didn't allow you to pick up last runes
* Vampire and shell runes now cap at 150 and 160 respectively
*
* 1.0.160 : This version actually works.
*
* 1.0.157 : When crazybounce is on, runes have larger touch radius
*
*
* 1.0.156 : Flight requires you to jump first now
* Also, spawn movement detection is less touchy
*
* 1.0.155 : Changed how dismay displays who hurt it
*
* 1.0.154 : Fixed a strength kills award bug
*
* 1.0.153 : Fixed a round start bug
*
* 1.0.152 : Fixed a seer bug
*
* 1.0.151 : Added rune reset cvar (sv_resetrunes)
*
* 1.0.150 : Since this version is a major overhaul of many features of the mod,
* And because I have fixed many many bugs that caused problems,
* I hearby announce this version as Version 1.0
* The mod is no longer in "alpha" phases.
*
* 0.4.150 : Changed the way seer works, and what it does.
* Removed phantom's secondary ability, it was conflicting
* With the primary one, and generally one ability was enough
* Added dismay redness
* (unreleased version)
*
* 0.4.149 : Feature rollback on features I removed in build 137
* (unreleased version)
*
*
* 0.4.140 : Feature rollback on features I removed in build 137
* (unreleased version)
*
* 0.4.134 : Fixing some stupid bugs
* (unreleased version)
*
* 0.4.130 : 3 new runes
* (unreleased version)
*
*
*
* 0.4.75 : Many new features:
* sv_autodrop cvar: drops runes when you touch them
* sv_grenadedrops : damage from an he grenade causes you to drop your rune.
* sv_runemod : disables or enables runemod
* sv_morerandom : randomized spawn generator, not as reliable as a cfg
* sv_totalrunes : set how many runes can be in the game, TOTAL.
* Note if the number somehow gets over this number (due to it being
* turned on after the fact, all runes players have are cleared)
* (unreleased version)
*
*
*
* 0.3.63 : Shell rune added, soul rune disabled by default because it is
* crappy in lan games, if you have a 16 player server
* it might be worth enabling again.
*
* 0.2.58 : Fixed some bugs with two of the same rune spawning
* Made resistance double armor, as well as health
* Made runes shoot out randomly from their spawn instead of sitting there
* (unreleased version)
*
* 0.2.56 : Fixed rune message error by removing it until I really fix it
*
*
* 0.2.50 : added support for nonconfig maps
* (but on players spawns (it's dumb, I know))
*
* 0.2.39 : fixed a bug, added new status text
*
* 0.1.38 First version
*
*
* -------------------------------------
* -------------------------------------
* Bailopan's CSDM, which was
* a huge help in making random entities,
* Thanks Bailopan!
* -------------------------------------
* to WC3 dopefish mod
* which is the credit and source
* of the original item code this mod
* was based off of.
* -------------------------------------
* thanks for superheros mod for various
* programming Also
* -------------------------------------
* thanks sub-w00fer for helping in testing
* with another player
* -------------------------------------
* Also, thanks dev\null for answering
* my questions on irc
* -------------------------------------
* Thanks EKS for the webpage thingy,
* sawce for seer help, and lille for dedicated
* server testing
* -------------------------------------
*/
/*
Programmer's notes:
400+id = if active, doesn't tell you if can't pick up or not
450+id = if active, can't pick up at all
550+id = task that, if active, means player is not yet able
to move. Once unactive, player is moving
500+id = show rune names tasks
1000+id+33xrunename runename's specified task
*/
#include <amxmodx>
#include <engine>
#include <fun>
#include <cstrike>
#include <amxmisc>
#define RESISTANCE 1
#define STRENGTH 2
#define HASTE 3
#define REGENERATION 4
#define VAMPIRISM 5
#define HUNTER 6
#define DISMAY 7
#define HEROICS 8
#define SOUL 9
#define INVISIBILITY 10
#define SHELL 11
#define SEER 12
#define PHANTOM 13
#define KINETICS 14
#define NULLLOC 9999
#define MAX_NAME_LENGTH 32
#define MAX_RUNES 14
#define MAX_SPAWNS 81
#define BEHINDBASESIZE 1500
#define MAXPLAYERS 32
#define TE_BEAMENTPOINT 1
#define TE_KILLBEAM 99
#define ShowViaHudSay 1
new Float:runecolors[MAX_RUNES+1][3] ={{0.0,0.0,0.0},{103.0,165.0,181.0},{12.0,10.0,10.0},{225.0,125.0,10.0},{10.0,10.0,255.0},{255.0,10.0,10.0},{10.0,255.0,30.0},{79.0,30.0,40.0},{255.0,255.0,255.0},{127.0,255.0,127.0},{127.0,10.0,127.0},{20.0,255.0,127.0},{120.0,50.0,225.0},{10.0,75.0,10.0},{255.0,255.0,10.0}}
new ItemName[MAX_RUNES][] = {"Resistance","Strength","Haste","Regeneration","Vampirism","Hunter","Dismay","Heroics","Soul","Invisibility","Shell","Seer","Phantom","Kinetics"}
new SingleDescription[100] = 0
new gMsgDeathMsg // "Death_MSG"'s ID
new SPAWN[MAX_SPAWNS][3]
new SPAWNS
new SPAWNS_ENABLED
new hasobject[MAXPLAYERS+1] = {0, ...}
new zoomed[MAXPLAYERS+1] = {0, ...} // Flag set if you are zoomed
new oldweaponid[MAXPLAYERS+1] = {0, ...} // Previous weapon for change weapon checking
new playerorigin[MAXPLAYERS+1][3] // Player origin for start_game movement checking
new invisorigin[3] = {0, ...} // Origin of the invisible guy if he is invisible
new bool:answer = false
new spriteindex
new runeflag[MAX_RUNES] = {0, ...}
new runetimerphantom = -1
new phantomorigin[3] = {0, ...}
new phantomoriginstart[3] = {0, ...}
new Float:phantomoriginstartfloat[3] = {0.0, ...}
new Float:unitvector[3] = {0.0, ...}
new fourthvar[MAXPLAYERS+1] = {0, ...}
new runemod_off = 0
// --------------------------------------------------------------------------------
// PLUGIN INIT
// --------------------------------------------------------------------------------
public plugin_init()
{
register_plugin("RuneMod", "1.0", "Kaddar")
gMsgDeathMsg = get_user_msgid("DeathMsg")
register_clcmd("dropitem","dropitem_call",0,"")
register_clcmd("help","help",0,"")
register_clcmd("say","sayparser")
register_cvar("sv_maxrunes","4") //how many runes per ROUND
register_cvar("sv_totalrunes","0") //how many runes TOTAL, 0 is off
register_cvar("sv_seer_range","12000")
for(new i = 1;i <= MAX_RUNES;i++)
{
new sv_commandname[20]
format (sv_commandname,19,"sv_%s",ItemName[i-1])
register_cvar(sv_commandname,"1")
}
set_cvar_num("sv_Soul",0)
register_cvar("sv_runemessage","1") // 0 disables RUNE SPAWNED:
register_cvar("sv_tellabouthelp","1") // 0 disables "type help for help"
register_cvar("sv_autodrop","0",FCVAR_SERVER) // 1 enables auto drop on rune touching
register_cvar("sv_crazybounce","0",FCVAR_SERVER)// 1 makes runes bounce like crazy
register_cvar("sv_runemod","1",FCVAR_SERVER) // 0 turns off runemod next round
register_cvar("sv_morerandom","1",FCVAR_SERVER) // 1 is less reliable but more random
register_cvar("sv_resetrunes","0",FCVAR_SERVER) // 1 means runes aren't kept from round to round (kinda unfun)
// register_cvar("sv_grenadedrops","0",FCVAR_SERVER) // set to 1 to make players drop runes when he grenaded
register_event("SendAudio","endRound","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
register_event("CurWeapon","change_weapon","be","1=1")
register_event("DeathMsg","death","a")
register_event("ResetHUD", "new_round", "b")
register_event("Damage", "damage_event", "b", "2!0")
register_event("SetFOV","zoomed2","be","1<90")
register_event("SetFOV","unzoomed","be","1=90")
register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
runemod_off = -1*(get_cvar_num("sv_runemod")-1)
readMapFile()
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// sayparser
// --------------------------------------------------------------------------------
public sayparser(id)
{
//Credit for parser: Superhero mod
new said[512]
read_args(said,511)
if(runemod_off == 1)
return PLUGIN_CONTINUE
if(equali(said,"^"/help^"") || equali(said,"^"help^""))
{
help(id)
return PLUGIN_HANDLED
}
else if(equali(said,"^"/dropitem^"") || equali(said,"^"dropitem^""))
{
client_print(id,print_chat,"Bind a key to it, don't say it, hit ~ and type: bind c dropitem")
return PLUGIN_HANDLED
}
else if(equali(said,"^"/droprune^"") || equali(said,"^"droprune^""))
{
client_print(id,print_chat,"The command is dropitem, and it's a console command.")
return PLUGIN_HANDLED
}
else if(equali(said,"^"/runelist^"") || equali(said,"^"runelist^""))
{
runelist(id)
return PLUGIN_HANDLED
}
else if(equali(said,"^"/playerrunes^"") || equali(said,"^"playerrunes^""))
{
playerrunes(id)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// DEATH
// --------------------------------------------------------------------------------
// On death, soul and heroics perform functions
// Heroics gains speed for killer
// Soul gains life for killer
//
//
public death()
{
new killer_id = read_data(1)
new victim_id = read_data(2)
if(runemod_off == 1)
return PLUGIN_CONTINUE
get_user_attacker(victim_id)
dropitem(victim_id)
if (get_user_team(killer_id) != get_user_team(victim_id))
{
if(hasobject[killer_id] == SOUL && is_user_alive(killer_id))
{
set_user_health(killer_id,100)
}
if(hasobject[killer_id] == HEROICS)
{
runeflag[HEROICS] += 75
}
}
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// Spawn Runes Event
// --------------------------------------------------------------------------------
public roundstart()
{
runemod_off = -1*(get_cvar_num("sv_runemod")-1)
if(runemod_off == 1)
{
for(new i = 1; i < MAXPLAYERS+1; i++ )
{
if(is_user_connected(i) && hasobject[i] > 0)
{
new itemid = hasobject[i]
hasobject[i] = 0
item_trigger(itemid,i,0)
}
}
remove_items()
}
else
{
if(get_cvar_num("sv_resetrunes") == 1)
{
for(new i = 1; i < 33; i++ )
{
if(is_user_connected(i) && hasobject[i] > 0)
{
new itemid = hasobject[i]
hasobject[i] = 0
item_trigger(itemid,i,0)
}
}
}
if(get_cvar_num("sv_tellabouthelp") == 1)
client_print(0,print_chat,"<Server> Say ^"help^" for rune mod info")
if(SPAWNS_ENABLED == 1)
{
spawnrunes()
}
else if(SPAWNS_ENABLED == 2)
{
client_print(0,print_chat,"<Server> MAP NOT SUPPORTED: Runes spawning on players")
spawnrunes()
}
else if(SPAWNS_ENABLED == 0)
client_print(0,print_chat,"<Server> RUNES WILL NOT SPAWN, TRY A DIFFERENT GENERATEMODE")
}
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// New Round
// --------------------------------------------------------------------------------
// Every new round, runes are removed, then spawned
// Player with resistance gets double life
// Player movement function readied and activated
//
//
public new_round(id)
{
new parm[1]
parm[0]=id
fourthvar[id] = NULLLOC
playerorigin[id][0] = NULLLOC
playerorigin[id][1] = NULLLOC
playerorigin[id][2] = NULLLOC
set_task(1.0,"is_moving",550+id,parm,1,"b") // To Set Speed Parms
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// End round
// --------------------------------------------------------------------------------
public endRound(id)
{
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: create runes on map
// --------------------------------------------------------------------------------
// Check to see what runes don't exist
// make a list of them
// select random runes from list to spawn
// check to see what random locations exist
// make a list of them
// select random locations from list to spawn runes
spawnrunes()
{
new available_runes[MAX_RUNES+1]
new runes_to_spawn = 0
new bool:rune_available
new runes_spawned = 0
// The following for command organizes the rune list into available_runes.
for(new j = 1; j <= MAX_RUNES; j++ )
{
rune_available = true
for(new i = 1; i < MAXPLAYERS+1; i++ )
{
if(!is_user_alive(i) && hasobject[i] != 0)
{
new itemid = hasobject[i]
hasobject[i] = 0
if(is_user_connected(i))
item_trigger(itemid,i,0)
}
if(hasobject[i] == j)
{
rune_available = false
runes_spawned++
}
}
is_rune_enabled(j)
if(answer == false)
rune_available=false
if(rune_available == true)
{
runes_to_spawn++
available_runes[runes_to_spawn] = j
}
}
//Randomize runes
for(new i = 1;i <= runes_to_spawn; i++ )
{
new randomizer = random(runes_to_spawn-1) + 1
new temp = available_runes[i]
available_runes[i] = available_runes[randomizer]
available_runes[randomizer] = temp
}
for(new i = 1;i <= runes_to_spawn; i++ )
{
new randomizer = random(runes_to_spawn-1) + 1
new temp = available_runes[i]
available_runes[i] = available_runes[randomizer]
available_runes[randomizer] = temp
}
//Randomize spawns
for(new i = 0;i < SPAWNS; i++ )
{
new randomizer = random(SPAWNS)
if(randomizer != i)
{
new temp[3]
temp[0] = SPAWN[i][0]
temp[1] = SPAWN[i][1]
temp[2] = SPAWN[i][2]
SPAWN[i][0] = SPAWN[randomizer][0]
SPAWN[i][1] = SPAWN[randomizer][1]
SPAWN[i][2] = SPAWN[randomizer][2]
SPAWN[randomizer][0] = temp[0]
SPAWN[randomizer][1] = temp[1]
SPAWN[randomizer][2] = temp[2]
}
}
new cangenerate
if(SPAWNS < runes_to_spawn)
cangenerate = SPAWNS
else if(SPAWNS >= runes_to_spawn)
cangenerate = runes_to_spawn
if(cangenerate > get_cvar_num("sv_maxrunes"))
cangenerate = get_cvar_num("sv_maxrunes")
if(runes_spawned > get_cvar_num("sv_totalrunes") && get_cvar_num("sv_totalrunes") != 0)
{
for(new i = 1; i < MAXPLAYERS+1; i++ )
{
if(is_user_connected(i) && hasobject[i] > 0)
{
new itemid = hasobject[i]
hasobject[i] = 0
item_trigger(itemid,i,0)
}
}
client_print(0,print_chat,"<Server> TOO MANY RUNES IN GAME, RUNES CLEARED")
remove_items()
}
if(cangenerate > get_cvar_num("sv_totalrunes") - runes_spawned && get_cvar_num("sv_totalrunes") > 0)
cangenerate = get_cvar_num("sv_totalrunes") - runes_spawned
new spawnlist[193] = ""
if(find_ent_by_class(-1,"kitems") > 0)
remove_items()
for(new i = 0;i < cangenerate; i++ )
{
new NewItem = create_entity("info_target")
if(NewItem == 0) {
client_print(0,print_chat,"<Server> RUNE GENERATION FAILED")
return PLUGIN_HANDLED_MAIN
}
if(get_cvar_num("sv_runemessage") == 1)
{
if(strlen(spawnlist) <= 160)
{
format (spawnlist,192,"%s %s",spawnlist,ItemName[available_runes[i+1]-1])
if(i+1 != cangenerate)
add(spawnlist,192,", ")
}
}
new Float:velocity[3]
new Float:temporg[3]
temporg[0] = float(SPAWN[i][0])
temporg[1] = float(SPAWN[i][1])
temporg[2] = float(SPAWN[i][2]+32)
new Float:MinBox[3]
new Float:MaxBox[3]
new Float:Color[3]
if(get_cvar_num("sv_crazybounce") ==0)
{
MinBox[0] = -2.5
MinBox[1] = -2.5
MinBox[2] = -2.5
MaxBox[0] = 2.5
MaxBox[1] = 2.5
MaxBox[2] = 2.5
}
else
{
MinBox[0] = -5.0
MinBox[1] = -5.0
MinBox[2] = -5.0
MaxBox[0] = 5.0
MaxBox[1] = 5.0
MaxBox[2] = 5.0
}
Color[0] = runecolors[available_runes[i+1]][0]
Color[1] = runecolors[available_runes[i+1]][1]
Color[2] = runecolors[available_runes[i+1]][2]
entity_set_int(NewItem, EV_INT_renderfx, kRenderFxGlowShell)
entity_set_float(NewItem, EV_FL_renderamt, 175.0)
entity_set_int(NewItem, EV_INT_rendermode, kRenderTransAlpha)
entity_set_vector(NewItem, EV_VEC_rendercolor,Color)
entity_set_string(NewItem, EV_SZ_classname, "kitems")
entity_set_model(NewItem, "models/w_weaponbox.mdl")
entity_set_vector(NewItem, EV_VEC_mins, MinBox)
entity_set_vector(NewItem, EV_VEC_maxs, MaxBox)
entity_set_origin(NewItem, temporg)
entity_set_int(NewItem, EV_INT_effects, 32)
entity_set_int(NewItem, EV_INT_solid, 1)
if(get_cvar_num("sv_crazybounce") != 0)
entity_set_int(NewItem, EV_INT_movetype, MOVETYPE_BOUNCE)
if(get_cvar_num("sv_crazybounce") == 0)
entity_set_int(NewItem, EV_INT_movetype,6)
//entity_set_edict(NewItem, EV_ENT_owner,0)
entity_set_int(NewItem, EV_INT_iuser4,available_runes[i+1])
velocity[0] = float(random(256)-128)
velocity[1] = float(random(256)-128)
velocity[2] = float(random(300)+75)
entity_set_vector(NewItem, EV_VEC_velocity,velocity)
}
if(get_cvar_num("sv_runemessage") == 1)
{
client_print(0,print_chat,"<Server> Runes spawned: %s",spawnlist)
}
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: remove items from level
// --------------------------------------------------------------------------------
// Clears all of itemtype "kitems" from map
//
//
//
//
public remove_items()
{
new nextitem = 0
do {
nextitem = find_ent_by_class(nextitem,"kitems")
if(nextitem > 0)
remove_entity(nextitem)
}
while(nextitem)
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// Connected client
// --------------------------------------------------------------------------------
// Probably not neccessary
//
//
//
//
public client_connect(id)
{
hasobject[id] = 0
oldweaponid[id] = 0
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// disconnected client
// --------------------------------------------------------------------------------
// neccessary
//
//
//
//
public client_disconnect(id)
{
if(hasobject[id] !=0)
dropitem(id)
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: is player in a different location than last check origin, NULLLOC = find origin
// --------------------------------------------------------------------------------
// Have we checked if a player is moving before?
// IF we have, has he moved?
// If he has, change his speed becuase we know he can move
//
//
public is_moving(id[])
{
new identy = id[0]
if(!is_user_alive(identy))
{
remove_task(550+identy)
return PLUGIN_HANDLED
}
if (fourthvar[id[0]] == NULLLOC)
{
fourthvar[id[0]] = 1
get_user_origin(identy,playerorigin[identy])
}
else
{
new origin[3]
get_user_origin(identy,origin)
if (playerorigin[identy][0] +2 < origin[0] || playerorigin[identy][0] -2 > origin[0] || playerorigin[identy][1] +2 < origin[1] || playerorigin[identy][1] -2 > origin[1])
{
fourthvar[id[0]] = NULLLOC
remove_task(550+identy)
if(runemod_off == 0)
item_trigger(hasobject[identy],identy,1)
}
}
return PLUGIN_HANDLED
}
// --------------------------------------------------------------------------------
// zoom detection
// --------------------------------------------------------------------------------
// For weapon speeds
public zoomed2(id){
if(runemod_off == 1)
return PLUGIN_CONTINUE
zoomed[id]=1
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// zoom detection2
// --------------------------------------------------------------------------------
// For weapon speeds
public unzoomed(id){
if(runemod_off == 1)
return PLUGIN_CONTINUE
zoomed[id]=0
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: SPEED RESET
// --------------------------------------------------------------------------------
// List from WC3 (by dopefish)
// This list resets player speeds to the correct speed
// Then modifies it depending on rune
//
//
public reset_speed(id)
{
new ammo
new clip
new weaponnum = get_user_weapon(id,clip,ammo)
if (weaponnum==3){ //scout
if (zoomed[id]==1)
set_user_maxspeed(id,220.0)
else
set_user_maxspeed(id,260.0) //220 zoomed
}
else if (weaponnum==4){ //hegrenad
set_user_maxspeed(id,260.0)
}
else if (weaponnum==5){ //xm1014
set_user_maxspeed(id,230.0)
}
else if (weaponnum==7){ //mac10
set_user_maxspeed(id,250.0)
}
else if (weaponnum==8){ //aug - bollup
set_user_maxspeed(id,240.0)
}
else if (weaponnum==9){ //smokegrenade
set_user_maxspeed(id,260.0)
}
else if (weaponnum==12){ //ump45
set_user_maxspeed(id,250.0)
}
else if (weaponnum==13){ //sg550
if (zoomed[id]==1)
set_user_maxspeed(id,150.0)
else
set_user_maxspeed(id,210.0) //150 zoomed
}
else if (weaponnum==18){ //awp
if (zoomed[id]==1)
set_user_maxspeed(id,150.0)
else
set_user_maxspeed(id,210.0) //150 zoomed
}
else if (weaponnum==19){ //mp5
set_user_maxspeed(id,250.0)
}
else if (weaponnum==20){ //m249
set_user_maxspeed(id,220.0)
}
else if (weaponnum==21){ //auto-shotty (m3)
set_user_maxspeed(id,240.0)
}
else if (weaponnum==14){ //galil
set_user_maxspeed(id,240.0)
}
else if (weaponnum==15){ //famas
set_user_maxspeed(id,240.0)
}
else if (weaponnum==22){ //M4A1
set_user_maxspeed(id,230.0)
}
else if (weaponnum==23){ //TMP
set_user_maxspeed(id,250.0)
}
else if (weaponnum==24){ //G3SG1
if (zoomed[id]==1)
set_user_maxspeed(id,150.0)
else
set_user_maxspeed(id,210.0) //150 zoomed
}
else if (weaponnum==25){ //flashbang
set_user_maxspeed(id,260.0)
}
else if (weaponnum==27){ //sg552
set_user_maxspeed(id,235.0)
}
else if (weaponnum==28){ //AK47
set_user_maxspeed(id,221.0)
}
else if (weaponnum==30){ //P90
set_user_maxspeed(id,245.0)
}
else if (weaponnum==1){ //p228
set_user_maxspeed(id,260.0)
}
else if (weaponnum==10 ){ //elite
set_user_maxspeed(id,260.0)
}
else if (weaponnum==11){ //fiveseven
set_user_maxspeed(id,260.0)
}
else if (weaponnum==26){ //deagle
set_user_maxspeed(id,260.0)
}
else if (weaponnum==16){ //usp
set_user_maxspeed(id,260.0)
}
else if (weaponnum==17){ //glock
set_user_maxspeed(id,260.0)
}
else if (weaponnum==29){ //knife
set_user_maxspeed(id,260.0)
}
else if (weaponnum==6){ //BOMB
set_user_maxspeed(id,260.0)
}
else {
set_user_maxspeed(id,260.0)
}
if(hasobject[id] == HASTE)
{
set_user_maxspeed(id,get_user_maxspeed(id) * 2.0)
}
else if(hasobject[id] == HEROICS)
{
set_user_maxspeed(id,get_user_maxspeed(id) + float(runeflag[HEROICS]))
}
if(runeflag[SEER] == id)
{
set_user_maxspeed(id,get_user_maxspeed(id) / 4.0)
}
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// Weapon Change
// --------------------------------------------------------------------------------
// When a weapon changes, we need to make certain things happen
// Speed must be reset (send to item_trigger, item trigger sends to reset)
// Invisibility possibility is checked
//
//
public change_weapon(id)
{
new weaponid = read_data(2)
if(runemod_off == 1)
return PLUGIN_CONTINUE
if (weaponid != oldweaponid[id] && is_user_alive(id) && !(task_exists(550+id)))
{
item_trigger(hasobject[id],id,1)
}
oldweaponid[id]=weaponid
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// Damage Taken
// --------------------------------------------------------------------------------
// Many runes deal with damage, some runes must fake a death message
// DISMAY, VAMPIRISM, STRENGTH, HUNTER, HEROICS
// all have damage modifiers
//
//
public damage_event(id)
{
new bodypart,weapon
new attacker = get_user_attacker(id,weapon,bodypart)
new damage = read_data(2)
new fakekill = 0
new fakeweapon = 0
if(runemod_off == 1)
return PLUGIN_CONTINUE
//Fake kill types:
//1: Killer is attacker, killed is id
//2: Killer is id, killed is attacker
/*
if(weapon == CSW_HEGRENADE && get_cvar_num("sv_grenadedrops")==1)
{
dropitem(id)
}
*/
// weapon is never equal to CSW_HEGRENADE due to problem with get_user_attacker
if (attacker == id || weapon==0)
{
return PLUGIN_CONTINUE
}
else if (attacker ==0)
{
return PLUGIN_CONTINUE
}
if(hasobject[attacker]==STRENGTH)
{
damage = damage*2
}
if(hasobject[attacker]==HEROICS)
{
if(weapon == CSW_DEAGLE || weapon == CSW_P228 || weapon == CSW_ELITE || weapon == CSW_FIVESEVEN || weapon == CSW_USP || weapon == CSW_GLOCK18)
{
damage = damage*2
}
}
if(hasobject[id]==RESISTANCE)
{
damage = damage/2
}
if(hasobject[id]==DISMAY)
{
if(is_user_alive(attacker))
{
new parmdismay[1]
parmdismay[0] = id
new temphealth
temphealth = floatround(float(get_user_health(attacker)) - (float(damage) * 0.5))
set_msg_block(gMsgDeathMsg, BLOCK_SET)
set_user_health(attacker,temphealth)
set_msg_block(gMsgDeathMsg, BLOCK_NOT)
entity_set_int(id, EV_INT_renderfx, kRenderFxGlowShell)
new Float:entcolor[3] = {127.0,20.0,20.0}
entity_set_float(id, EV_FL_renderamt, 255.0)
set_task(1.0,"dismay_loop",33*DISMAY+id+1000,parmdismay,1)
entity_set_vector(id, EV_VEC_rendercolor,entcolor)
if(temphealth <= 0)
{
fakekill=1
fakeweapon = -1
}
}
}
if(hasobject[id]==RESISTANCE)
{
if(is_user_alive(id))
{
new temp_damage
temp_damage = floatround(float(get_user_health(id)) + (float(damage)))
set_user_health(id,temp_damage)
if (get_user_health(id) > 100)
set_user_health(id,100)
}
}
if(hasobject[attacker]==VAMPIRISM)
{
if(is_user_alive(attacker))
{
new temp_damage
temp_damage = floatround(float(get_user_health(attacker)) + (float(damage) * 0.5))
set_user_health(attacker,temp_damage)
if (get_user_health(attacker) > 150)
set_user_health(attacker,150)
}
}
else if(hasobject[attacker]==SHELL)
{
if(is_user_alive(attacker))
{
new temp_damage
temp_damage = floatround(float(get_user_armor(attacker)) + (float(damage) * 0.5 + 4.0))
set_user_armor(attacker,temp_damage)
if (get_user_armor(attacker) > 160)
set_user_armor(attacker,160)
}
}
else if(hasobject[attacker]==KINETICS)
{
if(is_user_alive(id) && (weapon == CSW_DEAGLE || weapon == CSW_P228 || weapon == CSW_ELITE || weapon == CSW_FIVESEVEN || weapon == CSW_USP || weapon == CSW_GLOCK18))
{
new Float:velocity[3]
VelocityByAim(attacker, 800 , velocity)
entity_set_vector(id, EV_VEC_velocity, velocity)
}
}
else if(hasobject[attacker]==STRENGTH)
{
if(is_user_alive(id))
{
new temphealth = get_user_health(id) - damage/2
set_msg_block(gMsgDeathMsg, BLOCK_SET)
set_user_health(id,temphealth)
set_msg_block(gMsgDeathMsg, BLOCK_NOT)
if(temphealth <= 0)
{
fakekill=2
fakeweapon = weapon
}
}
}
else if(hasobject[attacker]==HUNTER)
{
if(is_user_alive(id) && weapon == CSW_KNIFE)
{
set_msg_block(gMsgDeathMsg, BLOCK_SET)
set_user_health(id,0)
set_msg_block(gMsgDeathMsg, BLOCK_NOT)
fakekill=2
fakeweapon = weapon
}
}
else if(hasobject[attacker]==HEROICS)
{
if(weapon == CSW_DEAGLE || weapon == CSW_P228 || weapon == CSW_ELITE || weapon == CSW_FIVESEVEN || weapon == CSW_USP || weapon == CSW_GLOCK18)
{
if(is_user_alive(id))
{
new temphealth = get_user_health(id) - damage/2
set_msg_block(gMsgDeathMsg, BLOCK_SET)
set_user_health(id,temphealth)
set_msg_block(gMsgDeathMsg, BLOCK_NOT)
if(temphealth <= 0)
{
fakekill=2
fakeweapon = weapon
}
}
}
}
if(fakekill==1)
exec_fakekill(id,attacker,fakeweapon)
else if(fakekill==2)
exec_fakekill(attacker,id,fakeweapon)
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: execute a faked kill
// --------------------------------------------------------------------------------
// Fines weapon name and awards a kill for a player
//
//
//
//
public exec_fakekill(killer,victim,weapon)
{
new weaponname[32]
if(weapon > 0)
{
switch (weapon)
{
case 1:
weaponname = "p228"
case 3:
weaponname = "scout"
case 4:
weaponname = "grenade"
case 5:
weaponname = "xm1014"
case 7:
weaponname = "mac10"
case 8:
weaponname = "aug"
case 10:
weaponname = "elite"
case 11:
weaponname = "fiveseven"
case 12:
weaponname = "ump45"
case 13:
weaponname = "sg550"
case 16:
weaponname = "usp"
case 17:
weaponname = "glock18"
case 18:
weaponname = "awp"
case 19:
weaponname = "mp5navy"
case 20:
weaponname = "m249"
case 21:
weaponname = "m3"
case 22:
weaponname = "m4a1"
case 23:
weaponname = "tmp"
case 24:
weaponname = "g3sg1"
case 26:
weaponname = "deagle"
case 27:
weaponname = "sg552"
case 28:
weaponname = "ak47"
case 29:
weaponname = "knife"
case 30:
weaponname = "p90"
}
}
else if (weapon == -1)
weaponname = "Dismay"
else
weaponname = "something"
if ( get_user_team(killer) != get_user_team(victim))
{
logKill(killer,victim, weaponname)
set_user_frags(victim, get_user_frags(victim) + 1 )
set_user_frags(killer, get_user_frags(killer)+ 1 )
new money = cs_get_user_money(killer)
if (cs_get_user_money(killer) < 16000)
cs_set_user_money(killer,money + 300,1)
}
else
{
set_user_frags(victim, get_user_frags(victim)+ 1 )
set_user_frags(killer, get_user_frags(killer) - 2)
new money = cs_get_user_money(killer)
if (cs_get_user_money(killer) != 0)
cs_set_user_money(killer,money - 150,1)
}
message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg"),{0,0,0},0)
write_byte(killer)
write_byte(victim)
write_byte(0)
write_string(weaponname)
message_end()
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: Log kill
// --------------------------------------------------------------------------------
// Credit: asskicker's HE grenade
logKill(id, victim, weaponDescription[] )
{
//Save Hummiliation
new namea[24],namev[24],authida[20],authidv[20],teama[8],teamv[8]
//Info On Attacker
get_user_name(id,namea,23)
get_user_team(id,teama,7)
get_user_authid(id,authida,19)
//Info On Victim
get_user_name(victim,namev,23)
get_user_team(victim,teamv,7)
get_user_authid(victim,authidv,19)
//Log This Kill
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
namea,get_user_userid(id),authida,teama,namev,get_user_userid(victim),authidv,teamv, weaponDescription )
}
public dropitem_call(id)
{
if(task_exists(550+id) && is_user_alive(id))
{
client_print(id,print_chat,"Can't drop rune until round starts!")
return PLUGIN_HANDLED
}
dropitem(id)
return PLUGIN_HANDLED
}
// --------------------------------------------------------------------------------
// FUNCTION: Drop item on death
// --------------------------------------------------------------------------------
// Activated by typing dropitem at the console, or just by dying
// Item_trigger is triggered with an off switch
//
//
//
dropitem(id)
{
if (hasobject[id] == 0)
return PLUGIN_CONTINUE
if (hasobject[id] < 0 || hasobject[id] > MAX_RUNES)
{
client_print(id,print_chat,"ERROR: BAD RUNE")
return PLUGIN_HANDLED_MAIN
}
new itemid = hasobject[id]
hasobject[id] = 0
item_trigger(itemid,id,0)
if(get_cvar_num("sv_autodrop") == 1)
set_task(0.6,"empty_delay",450+id,"",0)
else
set_task(0.3,"empty_delay",450+id,"",0)
new NewItem = create_entity("info_target")
if(NewItem == 0)
return PLUGIN_HANDLED_MAIN
new Float:g_origin[3]
entity_get_vector(id,EV_VEC_origin,g_origin)
new Float:velocity[3]
new Float:MinBox[3]
new Float:MaxBox[3]
new Float:Color[3]
if(get_cvar_num("sv_crazybounce") ==0)
{
MinBox[0] = -2.5
MinBox[1] = -2.5
MinBox[2] = -2.5
MaxBox[0] = 2.5
MaxBox[1] = 2.5
MaxBox[2] = 2.5
}
else
{
MinBox[0] = -5.0
MinBox[1] = -5.0
MinBox[2] = -5.0
MaxBox[0] = 5.0
MaxBox[1] = 5.0
MaxBox[2] = 5.0
}
Color[0] = runecolors[itemid][0]
Color[1] = runecolors[itemid][1]
Color[2] = runecolors[itemid][2]
entity_set_int(NewItem, EV_INT_renderfx, kRenderFxGlowShell)
entity_set_float(NewItem, EV_FL_renderamt, 150.0)
entity_set_int(NewItem, EV_INT_rendermode, kRenderTransAlpha)
entity_set_vector(NewItem, EV_VEC_rendercolor,Color)
entity_set_string(NewItem, EV_SZ_classname, "kitems")
entity_set_model(NewItem, "models/w_weaponbox.mdl")
entity_set_vector(NewItem, EV_VEC_mins, MinBox)
entity_set_vector(NewItem, EV_VEC_maxs, MaxBox)
entity_set_origin(NewItem, g_origin)
entity_set_int(NewItem, EV_INT_effects, 32)
entity_set_int(NewItem, EV_INT_solid, 1)
if(get_cvar_num("sv_crazybounce") != 0)
entity_set_int(NewItem, EV_INT_movetype, MOVETYPE_BOUNCE)
if(get_cvar_num("sv_crazybounce") == 0)
entity_set_int(NewItem, EV_INT_movetype,6)
entity_set_edict(NewItem, EV_ENT_owner,id)
entity_set_int(NewItem, EV_INT_iuser4,itemid)
VelocityByAim(id, 400 , velocity)
entity_set_vector(NewItem, EV_VEC_velocity, velocity)
emit_sound(NewItem, CHAN_WEAPON, "items/weapondrop1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// PLAYER TOUCHES THING
// --------------------------------------------------------------------------------
public pfn_touch(ptr, ptd)
{
new itemClassName[MAX_NAME_LENGTH] = {0, ...}
new playerClassname[MAX_NAME_LENGTH] = {0, ...}
if(ptr !=0)entity_get_string(ptr, EV_SZ_classname, itemClassName, MAX_NAME_LENGTH-1)
if(ptd !=0)entity_get_string(ptd, EV_SZ_classname, playerClassname, MAX_NAME_LENGTH-1)
if(equal(itemClassName,"kitems") && equal(playerClassname,"player"))
{
if(task_exists(450 + ptd) || !is_user_alive(ptd))
return PLUGIN_CONTINUE
if(hasobject[ptd] != 0)
{
if (!task_exists(400+ptd))
{
if (get_cvar_num("sv_autodrop")==0)
{
new tempitemname = entity_get_int(ptr, EV_INT_iuser4)
client_print(ptd,print_chat,"Already have rune, can't get: %s",ItemName[tempitemname-1])
set_task(2.0,"empty_delay",400+ptd,"",0)
}
else
{
dropitem(ptd)
hasobject[ptd] = entity_get_int(ptr, EV_INT_iuser4)
item_trigger(hasobject[ptd],ptd,1)
set_singledesc(hasobject[ptd])
emit_sound(ptr, CHAN_WEAPON, "items/gunpickup1.wav", 0.5, ATTN_NORM, 0, PITCH_NORM)
client_print(ptd,print_chat,"You picked up: %s",ItemName[hasobject[ptd]-1])
client_print(ptd,print_chat,"Abilities: %s",SingleDescription)
remove_entity(ptr)
}
}
return PLUGIN_CONTINUE
}
else if (hasobject[ptd] == 0)
{
hasobject[ptd] = entity_get_int(ptr, EV_INT_iuser4)
item_trigger(hasobject[ptd],ptd,1)
set_singledesc(hasobject[ptd])
emit_sound(ptr, CHAN_WEAPON, "items/gunpickup1.wav", 0.5, ATTN_NORM, 0, PITCH_NORM)
client_print(ptd,print_chat,"You picked up: %s",ItemName[hasobject[ptd]-1])
client_print(ptd,print_chat,"Abilities: %s",SingleDescription)
remove_entity(ptr)
}
}
return PLUGIN_CONTINUE
}
public empty_delay()
{
//intentionally empty
}
// --------------------------------------------------------------------------------
// FUNCTION: Item needs activation or deactivation (on is set on activation)
// --------------------------------------------------------------------------------
// Send to this function to turn on speed items
// Is activated:
// When player moves at the beginning of a round
// When player changes weapon
// When player picks up item
// When player drops item (on = 0)
// When player dies (on = 0)
// When admin resets items with reset_items function for all players
item_trigger(itemid,id,on)
{
#if ShowViaHudSay == 1
if(is_user_connected(id) && on && itemid > 0)
{
new newmessage[120]
set_shortdesc(itemid)
format (newmessage,119,"%s^n %s",ItemName[itemid-1],SingleDescription)
set_hudmessage(255, 255, 255, 0.03, 0.85, 0, 6.0, 6.0, 0.5, 10.0,2)
show_hudmessage(id,newmessage)
}
if(is_user_connected(id) && !on)
{
set_hudmessage(255, 255, 255, 0.03, 0.85, 0, 6.0, 6.0, 0.5, 10.0,2)
show_hudmessage(id,"")
}
#else
if(is_user_connected(id) && on && itemid > 0)
{
new statusMsg=get_user_msgid("StatusText")
new newmessage[120]
set_shortdesc(itemid)
format (newmessage,119,"%s - %s",ItemName[itemid-1],SingleDescription)
message_begin( MSG_ONE, statusMsg,{0,0,0},id)
write_byte(0)
write_string(newmessage)
message_end()
}
if(is_user_connected(id) && !on)
{
new statusMsg=get_user_msgid("StatusText")
message_begin( MSG_ONE, statusMsg,{0,0,0},id)
write_byte(0)
write_string("")
message_end()
}
#endif
new parmtrigger[1]
parmtrigger[0]=id
if(itemid == REGENERATION)
{
if(get_user_health(id) > 100 && !on)
set_user_health(id,100)
if(!task_exists(33*REGENERATION+id+1000) && on)
{
set_task(1.0,"regen_loop",33*REGENERATION+id+1000,parmtrigger,1,"b")
}
}
else if(itemid == VAMPIRISM)
{
if(get_user_health(id) > 100 && !on)
set_user_health(id,100)
}
else if(itemid == SHELL)
{
if(get_user_armor(id) > 100 && !on)
set_user_armor(id,100)
}
else if(itemid == INVISIBILITY)
{
if(!task_exists(33*INVISIBILITY+id+1000) && on)
{
runeflag[INVISIBILITY]= 0
invisorigin[0] = NULLLOC
invisorigin[1] = NULLLOC
invisorigin[2] = NULLLOC
set_task(0.4,"invis_loop",33*INVISIBILITY+id+1000,parmtrigger,1,"b")
}
}
else if(itemid == HUNTER)
{
set_user_footsteps(id,on)
if(get_user_armor(id) > 100 && !on)
set_user_armor(id,100)
if(!task_exists(33*HUNTER+id+1000) && on)
{
set_task(1.0,"aregen_loop",33*HUNTER+id+1000,parmtrigger,1,"b")
}
}
else if(itemid == HEROICS)
{
if (!on)
runeflag[HEROICS]=0
}
else if(itemid == KINETICS)
{
set_user_gravity(id,1.0 - float(on)*0.33)
if(!task_exists(33*KINETICS+id+1000) && on)
{
set_task(0.2,"flight_loop",33*KINETICS+id+1000,parmtrigger,1,"b")
}
}
else if(itemid == PHANTOM)
{
if(!task_exists(33*PHANTOM+id+1000) && on)
{
set_task(0.2,"phantom_loop",33*PHANTOM+id+1000,parmtrigger,1,"b")
}
}
else if(itemid == SEER)
{
if(!task_exists(33*SEER+id+1000) && on)
{
set_task(0.5,"seer_loop",33*SEER+id+1000,parmtrigger,1,"b")
}
}
reset_speed(id)
return PLUGIN_HANDLED
}
// --------------------------------------------------------------------------------
// FUNCTION: Invisibility LOOP
// --------------------------------------------------------------------------------
public invis_loop(id[])
{
if(hasobject[id[0]] == INVISIBILITY && is_user_alive(id[0]))
{
if (invisorigin[0] == NULLLOC && invisorigin[1] == NULLLOC && invisorigin[2] == NULLLOC)
get_user_origin (id[0],invisorigin)
else
{
new clip, ammo
new weapon_id = get_user_weapon(id[0],clip,ammo)
new origin[3]
get_user_origin (id[0],origin)
if (invisorigin[0] != origin[0] || invisorigin[1] != origin[1] || invisorigin[2] != origin[2] || weapon_id != 29)
{
if(runeflag[INVISIBILITY] == 1)
{
client_print(id[0],print_chat,"You're no longer invisible!")
set_user_rendering ( id[0],kRenderFxNone , 0,0,0,kRenderNormal,16)
runeflag[INVISIBILITY]=0
}
}
else
{
if(runeflag[INVISIBILITY] == 0)
{
client_print(id[0],print_chat,"You're now invisible!")
runeflag[INVISIBILITY] = 1
}
set_user_rendering ( id[0],kRenderFxNone , 0,0,0,kRenderTransTexture,0)
}
get_user_origin (id[0],invisorigin)
}
}
else
{
if(runeflag[INVISIBILITY] == 1)
{
client_print(id[0],print_chat,"You're no longer invisible!")
set_user_rendering ( id[0],kRenderFxNone , 0,0,0,kRenderNormal,16)
runeflag[INVISIBILITY]=0
}
remove_task(33*INVISIBILITY+id[0]+1000)
}
return PLUGIN_HANDLED
}
// --------------------------------------------------------------------------------
// FUNCTION: Seer LOOP
// --------------------------------------------------------------------------------
public seer_loop(id[])
{
if(hasobject[id[0]] == SEER && is_user_alive(id[0]))
{
new playeraimed
new bodypartaimed
get_user_aiming(id[0],playeraimed,bodypartaimed)
if(playeraimed < MAXPLAYERS+1 && playeraimed >0 && is_user_alive(playeraimed) && cs_get_user_team(id[0]) != cs_get_user_team(playeraimed))
{
runeflag[SEER]=playeraimed
reset_speed(playeraimed)
}
else
{
if(runeflag[SEER]!=0 && is_user_alive(runeflag[SEER]))
{
new idtarget
idtarget = runeflag[SEER]
runeflag[SEER]=0
reset_speed(idtarget)
}
}
new closest = 99999
new idclosest = 0
for(new i=1;i <MAXPLAYERS+1;i++)
{
if(is_user_alive(i) && get_user_team(i) != get_user_team(id[0]))
{
if(get_entity_distance (i, id[0] ) < closest || closest == 99999)
{
closest = get_entity_distance (i, id[0] )
idclosest = i
}
}
}
if(idclosest !=0)
{
message_begin( MSG_ONE, SVC_TEMPENTITY,{0,0,0},id[0] )
write_byte( TE_KILLBEAM )
write_short( id[0])
message_end()
new vector[3]
new width
new brightness
new Float:seerpower
get_user_origin(idclosest,vector,1)
seerpower = 1.0 - float(closest) / get_cvar_num("sv_seer_range")
brightness = floatround(floatsqroot (seerpower)*255.0)
width = floatround(floatsqroot (seerpower)*60.0)
if (brightness < 0)
brightness = 0
if (width<0)
width = 0
if(brightness && width)
{
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id[0])
write_byte ( TE_BEAMENTPOINT )
write_short(id[0])// short (start entity)
write_coord(vector[0])// coords
write_coord(vector[1])// coords
write_coord(vector[2])// coords
write_short(spriteindex)// short (sprite index)
write_byte(1)// byte (starting frame)
write_byte(0)// byte (frame rate in 0.1's)
write_byte(0)// byte (life in 0.1's)
write_byte(width)// byte (line width in 0.1's)
write_byte(0)// byte (noise amplitude in 0.01's)
write_byte(0)// byte,byte,byte (color)
write_byte(0)// byte,byte,byte (color)
write_byte(255)// byte,byte,byte (color)
write_byte(brightness)// byte (brightness)
write_byte(100)// byte (scroll speed in 0.1's)
message_end()
}
}
else
{
message_begin( MSG_ONE, SVC_TEMPENTITY,{0,0,0},id[0] )
write_byte( TE_KILLBEAM )
write_short( id[0])
message_end()
}
}
else
{
message_begin( MSG_ONE, SVC_TEMPENTITY,{0,0,0},id[0] )
write_byte( TE_KILLBEAM )
write_short( id[0])
message_end()
if(runeflag[SEER]!=0)
{
new idtarget
idtarget = runeflag[SEER]
runeflag[SEER]=0
reset_speed(idtarget)
}
remove_task(33*SEER+id[0]+1000)
}
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: Dismay (one time) loop
// --------------------------------------------------------------------------------
public dismay_loop(id[])
{
entity_set_int(id[0], EV_INT_renderfx, kRenderFxNone )
return PLUGIN_CONTINUE
}
// --------------------------------------------------------------------------------
// FUNCTION: Phantom LOOP
// --------------------------------------------------------------------------------
public phantom_loop(id[])
{
new playerid = id[0]
if(hasobject[id[0]] == PHANTOM && is_user_alive(id[0]))
{
new playeraimed
new phantomoriginb[3]
new bodypartaimed
new distance
new hitorigin[3]
get_user_aiming (id[0],playeraimed,bodypartaimed,distance)
get_user_origin (id[0],phantomoriginb,1)
get_user_origin (id[0],hitorigin,3)
distance=get_distance(phantomoriginb,hitorigin)
VelocityByAim (id[0],1,unitvector)
new taskid = (MAX_RUNES+1)*33+PHANTOM*33+1000+id[0]
if(distance <= 24 && playeraimed == 0 && !task_exists(taskid))
{
if(!(get_user_button(playerid)&IN_DUCK))
{
entity_set_int(playerid, EV_INT_renderfx, kRenderFxGlowShell)
new Float:entcolor[3] = {255.0,255.0,255.0}
entity_set_float(playerid, EV_FL_renderamt, 255.0)
entity_set_vector(playerid, EV_VEC_rendercolor,entcolor)
entity_get_vector(playerid,EV_VEC_origin,phantomoriginstartfloat)
runeflag[PHANTOM] = 1
runetimerphantom = 2
get_user_origin (id[0],phantomoriginstart,0)
set_user_noclip(playerid,1)
set_task(1.0,"phantom_timer",taskid,id,1,"a",runetimerphantom+1)
}
}
}
else
{
if(runeflag[PHANTOM] == 1)
{
entity_set_int(playerid, EV_INT_renderfx, kRenderFxNone )
set_user_noclip(playerid,0)
runeflag[PHANTOM] = 0
runetimerphantom = -1
entity_set_vector(playerid,EV_VEC_origin,phantomoriginstartfloat)
}
remove_task(33*PHANTOM+id[0]+1000)
}
return PLUGIN_CONTINUE
}
public phantom_timer(id[1])
{
new playerid=id[0]
//superhero nightcrawler was inspiration
if (runetimerphantom>0 )
{
runetimerphantom--
new message[128]
format(message, 127, "%d seconds until rematerializing", runetimerphantom )
set_hudmessage(255,0,0,-1.0,0.3,0,1.0,1.0,0.0,0.0,4)
show_hudmessage( id[0], message)
}
else
{
if ( runetimerphantom == 0 && runeflag[PHANTOM])
{
runetimerphantom=-1
set_user_noclip(playerid,0)
new origin[3]
new Float:velocity[3]
get_user_origin(playerid, origin)
phantomorigin[0]=origin[0]
phantomorigin[1]=origin[1]
phantomorigin[2]=origin[2]
entity_get_vector(id[0], EV_VEC_velocity, velocity)
if (!velocity[0] || !velocity[1])
{
velocity[0]=unitvector[0]*64.0+unitvector[2]*8.0+2.0
velocity[1]=unitvector[1]*64.0+unitvector[2]*8.0+2.0
entity_set_vector(id[0], EV_VEC_velocity, velocity)
}
set_task(0.4,"phantom_moved",0,id,1)
}
}
}
public phantom_moved( parm[1] )
{
new playerid=parm[0]
new origin[3]
if (!is_user_alive(playerid) )
{
entity_set_int(playerid, EV_INT_renderfx, kRenderFxNone )
runeflag[PHANTOM] = 0
return
}
get_user_origin(playerid, origin)
if (!(phantomorigin[0] +2 < origin[0] || phantomorigin[0] -2 > origin[0] || phantomorigin[1] +2 < origin[1] || phantomorigin[1] -2 > origin[1]))
{
if(is_user_alive(playerid))
{
runetimerphantom = -1
entity_set_vector(playerid,EV_VEC_origin,phantomoriginstartfloat)
}
}
entity_set_int(playerid, EV_INT_renderfx, kRenderFxNone )
runeflag[PHANTOM] = 0
}
// --------------------------------------------------------------------------------
// FUNCTION: Flightloop
// --------------------------------------------------------------------------------
public flight_loop(id[])
{
if(hasobject[id[0]] == KINETICS && is_user_alive(id[0]))
{
new clip, ammo
new weapon_id = get_user_weapon(id[0],clip,ammo)
if(weapon_id == 29 && !task_exists(550+id[0]) && !(entity_get_int(id[0],EV_INT_flags) & FL_ONGROUND))
{
new Float:velocity[3]
VelocityByAim(id[0],400, velocity)
velocity[0] = velocity[0&
I recomend taking out the comments cause it seems that the end was chopped off