Member
|
10-06-2007
, 05:45
4 errors of a cool hero help me plz
|
#1
|
hi im making a hero that can teleport become invisible and shoot with a scout where the shots are laser bullets but cant get the teleport part to work it is named Assasin can anybody look at it.... plzzz
this is what it look like
Code:
//Assasin
//Credits go to Vittu for Master Chief´s Morphing Code and Teh Creators of Cyclops
/* CVARS - copy and paste to shconfig.cfg
//Assasin
Assasin_level 10 //Level needed to get hero
Assasin_teamglow 0 //Glow Team Color when player skin in use (0=no 1=yes)
Assasin_scoutmult 2.0 //Damage multiplyer for his Ak47
Assasin_health 150 //Default 150
Assasin_armor 150 //Default 150
Assasin_teamcolored 1 //Default 1
Assasin_amount 4 //Ammount of teleportaions available
Assasin_cooldown 10 //Cooldown timer between uses
Assasin_delay 1.5 //Delay time before the teleport occurs
Assasin_delaystuck 0 //Is the user stuck in place during the delay?
#include <amxmod>
#include <vexd_utilities>
#include <superheromod>
// GLOBAL VARIABLES
new gHeroName[]="Assasin"
new bool:gHasAssasinPower[SH_MAXSLOTS+1]
new bool:gmorphed[SH_MAXSLOTS+1]
new gTaskID
new gAssasinSound[]="items/suitchargeno1.wav"
new lastammo[33]
new spriteindex, smoke
new gIsInvisible[SH_MAXSLOTS+1]
new gStillTime[SH_MAXSLOTS+1]
new AssasinAmount[SH_MAXSLOTS+1]
new checkCount[SH_MAXSLOTS+1]
new AssasinSpot[SH_MAXSLOTS+1][3]
new origAssasinSpot[SH_MAXSLOTS+1][3]
new g_lastPosition[SH_MAXSLOTS+1][3] // Variable to help with position checking
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Assasin","1.0","B.A.N.G.E.R.S")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("Assasin_level", "0")
register_cvar("Assasin_teamglow", "0")
register_cvar("Assasin_ak47mult", "2.0")
register_cvar("Assasin_health", "150")
register_cvar("Assasin_armor", "150")
register_cvar("Assasin_teamcolored", "1")
register_cvar("Assasin_alpha", "50")
register_cvar("Assasin_delay", "5")
register_cvar("Assasin_checkmove", "1")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "CTrooper", "Become a Clone Trooper! - Cooler Player Model and Gun and laser bullets", false, "CTrooper_level" )
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
register_event("ResetHUD","newRound","b")
register_event("Damage", "Assasin_damage", "b", "2!0")
register_srvcmd("Assasin_init", "Assasin_init")
shRegHeroInit(gHeroName, "Assasin_init")
// INIT
register_srvcmd("Assasin_init", "Assasin_init")
shRegHeroInit(gHeroName, "Assasin_init")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
register_event("CurWeapon", "weaponChange", "be", "1=1")
register_event("ResetHUD", "newSpawn", "b")
register_event("Damage", "Assasin_damage", "b", "2!0")
register_event("DeathMsg", "Assasin_death", "a")
// Let Server know about Assasin's Variables
shSetShieldRestrict(gHeroName)
shSetMaxHealth(gHeroName, "Assasin_health")
shSetMaxArmor(gHeroName, "Assasin_armor")
//Check some buttons
set_task(0.1,"checkButtons",0,"",0,"b")
// KEY DOWN
register_srvcmd("Assasin_kd", "Assasin_kd")
shRegKeyDown(gHeroName, "Assasin_kd")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
smoke = precache_model("sprites/steam1.spr")
spriteindex = precache_model("sprites/laserbeam.spr")
precache_sound("weapons/electro5.wav")
precache_model("models/shmod/shadown_assasin.mdl")
precache_model("models/shmod/Assasin_v_scout.mdl")
precache_sound(gAssasinSound)
precache_sound("shmod/Assasin_teleport.wav")
}
//----------------------------------------------------------------------------------------------
public Assasin_init()
{
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
// 2nd Argument is 0 or 1 depending on whether the id has Assasin
read_argv(2,temp,5)
new hasPowers = str_to_num(temp)
//Give Powers to the Invisible Man
if ( !gHasAssasinPower[id] ) remInvisibility(id)
gHasAssasinPower[id] = (hasPowers != 0)
//Reset thier shield restrict status
//Shield restrict MUST be before weapons are given out
shResetShield(id)
if ( is_user_connected(id) ) {
if ( gHasAssasinPower[id] ) {
Assasin_weapons(id)
switchmodel(id)
Assasin_tasks(id)
}
else {
engclient_cmd(id, "drop", "weapon_scout")
Assasin_unmorph(id)
shRemHealthPower(id)
shRemArmorPower(id)
shRemGravityPower(id)
shRemSpeedPower(id)
newRound(id)
}
}
}
//----------------------------------------------------------------------------------------------
public newRound(id)
{
remove_task(id)
gPlayerUltimateUsed[id] = false
AssasinAmount[id] = get_cvar_num("Assasin_amount")
}
//----------------------------------------------------------------------------------------------
public make_tracer(id)
{
if (!gHasAssasinPower[id]) return PLUGIN_CONTINUE
new clip, ammo
new wpnid = get_user_weapon(id, clip, ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((lastammo[id] > clip) && (wpnid == CSW_SCOUT) ) {
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1) // origin; your camera point.
get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
emit_sound(id,CHAN_ITEM, "weapons/electro5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// DELIGHT
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 27 )
write_coord( vec1[0] ) //pos
write_coord( vec1[1] )
write_coord( vec1[2] )
write_byte( 10 )
write_byte( 250 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 2 ) // life
write_byte( 1 ) // decay
message_end()
//BEAMENTPOINTS
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0) //TE_BEAMENTPOINTS 0
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short(spriteindex)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(10) // width
write_byte(0) // noise
if (!get_cvar_num("Assasin_teamcolored")) {
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
}
// Terrorist
else if (get_user_team(id)==1) {
write_byte( 100 ) // r, g, b
write_byte( 100 ) // r, g, b
write_byte( 255 ) // r, g, b
}
// Counter-Terrorist
else {
write_byte( 255 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 255 ) // r, g, b
}
write_byte(200) // brightness
write_byte(200) // speed
message_end()
//Sparks
message_begin( MSG_PVS, SVC_TEMPENTITY)
write_byte(9)
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
message_end()
//Smoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(5) // 5
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short(smoke)
write_byte(22) // 10
write_byte(10) // 10
message_end()
}
lastammo[id] = clip
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( gHasAssasinPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "Assasin_weapons", id)
Assasin_tasks(id)
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid != CSW_SCOUT && wpnid > 0) {
new wpn[32]
get_weaponname(wpnid,wpn,31)
engclient_cmd(id,wpn)
remInvisibility(id)
}
}
}
//----------------------------------------------------------------------------------------------
public Assasin_tasks(id)
{
set_task(1.0, "Assasin_morph", id)
if( get_cvar_num("Assasin_teamglow") ){
set_task(1.0, "Assasin_glow", id+gTaskID, "", 0, "b" )
}
}
//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
if ( !is_user_alive(id) || !gHasAssasinPower[id] ) return
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if (wpnid == CSW_SCOUT) {
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/Assasin_v_scout.mdl")
}
}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
if ( !gHasAssasinPower[id] || !shModActive() ) return
new wpnid = read_data(2)
new clip = read_data(3)
if ( wpnid != CSW_SCOUT ) return
switchmodel(id)
// Never Run Out of Ammo!
if ( clip == 0 ) {
shReloadAmmo(id)
}
}
//----------------------------------------------------------------------------------------------
public Assasin_weapons(id)
{
if ( is_user_alive(id) ) {
shGiveWeapon(id,"weapon_scout")
}
}
//----------------------------------------------------------------------------------------------
public Assasin_damage(id)
{
if (!shModActive() || !is_user_alive(id)) return
new damage = read_data(2)
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
new headshot = bodypart == 1 ? 1 : 0
if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return
if ( gHasAssasinPower[attacker] && weapon == CSW_SCOUT && is_user_alive(id) ) {
if ( gHasAssasinPower[attacker] && is_user_alive(id) ) {
// do extra damage
new extraDamage = floatround(damage * get_cvar_float("ctrooper_scoutmult") - damage)
if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "scout", headshot )
if (!shModActive() || !gHasAssasinPower[id] ) return
remInvisibility(id)
}
}
}
//----------------------------------------------------------------------------------------------
public Assasin_sound(id)
{
emit_sound(id, CHAN_AUTO, gAssasinSound, 0.2, ATTN_NORM, SND_STOP , PITCH_NORM)
emit_sound(id, CHAN_AUTO, gAssasinSound, 0.2, ATTN_NORM, 0, PITCH_NORM)
}
//----------------------------------------------------------------------------------------------
public Assasin_morph(id)
{
if ( gmorphed[id] || !is_user_alive(id) ) return
#if defined AMXX_VERSION
cs_set_user_model(id, "clonetrooper")
#else
CS_SetModel(id, "clonetrooper")
#endif
Assasin_sound(id)
// Message
set_hudmessage(50, 205, 50, -1.0, 0.40, 2, 0.02, 4.0, 0.01, 0.1, 7)
show_hudmessage(id, "Assasin - where did the target go!!!")
gmorphed[id] = true
}
//----------------------------------------------------------------------------------------------
public Assasin_unmorph(id)
{
if ( gmorphed[id] ) {
// Message
set_hudmessage(50, 205, 50, -1.0, 0.40, 2, 0.02, 4.0, 0.01, 0.1, 7)
show_hudmessage(id, "Assasin - i'm down sir.... scrat.... scrat.... HELP!!!")
#if defined AMXX_VERSION
cs_reset_user_model(id)
#else
CS_ClearModel(id)
#endif
Assasin_sound(id)
gmorphed[id] = false
if ( get_cvar_num("Assasin_teamglow") ) {
remove_task(id+gTaskID)
set_user_rendering(id)
}
}
}
//----------------------------------------------------------------------------------------------
public Assasin_glow(id)
{
id -= gTaskID
if ( !is_user_connected(id) ) {
//Don't want any left over residuals
remove_task(id+gTaskID)
return
}
if ( gHasAssasinPower[id] && is_user_alive(id)) {
if ( get_user_team(id) == 1 ) {
shGlow(id, 255, 0, 0)
}
else {
shGlow(id, 0, 0, 255)
}
}
}
//----------------------------------------------------------------------------------------------
public Assasin_death()
{
new id = read_data(2)
Assasin_unmorph(id)
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gmorphed[id] = false
}
//----------------------------------------------------------------------------------------------
public setInvisibility(id, alpha)
{
if (alpha < 125) {
set_user_rendering(id,kRenderFxGlowShell,8,8,8,kRenderTransAlpha,alpha)
}
else {
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,alpha)
}
}
//-----------------------------------------------------------------------------------------------
public remInvisibility(id)
{
gStillTime[id] = -1
if (gIsInvisible[id] > 0) {
shUnglow(id)
client_print(id,print_center,"[SH]Assasin Man: You are spotted get back in the dark!!!")
}
gIsInvisible[id] = 0
}
//----------------------------------------------------------------------------------------------
public checkButtons()
{
if ( !hasRoundStarted() || !shModActive()) return
new bool:setVisible
new butnprs
for(new id = 1; id <= SH_MAXSLOTS; id++) {
if (!is_user_alive(id) || !gHasAssasinPower[id]) continue
setVisible = false
butnprs = Entvars_Get_Int(id, EV_INT_button)
//Always check these
if (butnprs&IN_ATTACK || butnprs&IN_ATTACK2 || butnprs&IN_RELOAD || butnprs&IN_USE) setVisible = true
//Only check these if invisman_checkmove is off
if ( get_cvar_num("Assasin_checkmove") ) {
if (butnprs&IN_JUMP) setVisible = true
if (butnprs&IN_FORWARD || butnprs&IN_BACK || butnprs&IN_LEFT || butnprs&IN_RIGHT) setVisible = true
if (butnprs&IN_MOVELEFT || butnprs&IN_MOVERIGHT) setVisible = true
}
if (setVisible) remInvisibility(id)
else {
new sysTime = get_systime()
new delay = get_cvar_num("Assasin_delay")
if ( gStillTime[id] < 0 ) {
gStillTime[id] = sysTime
}
if ( sysTime - delay >= gStillTime[id] ) {
if (gIsInvisible[id] != 100) client_print(id,print_center,"[SH]Assasin Man: 100%s cloaked", "%")
gIsInvisible[id] = 100
setInvisibility(id, get_cvar_num("Assasin_alpha"))
}
else if ( sysTime > gStillTime[id] ) {
new alpha = get_cvar_num("Assasin_alpha")
new Float:prcnt = float(sysTime - gStillTime[id]) / float(delay)
new rPercent = floatround(prcnt * 100)
alpha = floatround(255 - ((255 - alpha) * prcnt) )
client_print(id,print_center,"[SH]Assasin Man: %d%s cloaked", rPercent, "%")
gIsInvisible[id] = rPercent
setInvisibility(id, alpha)
}
}
}
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public Assasin_kd()
{
if ( !hasRoundStarted() ) return PLUGIN_HANDLED
// First Argument is an id with Blink Powers!
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
if ( !is_user_alive(id) || !ghasAssasinPower[id] ) return PLUGIN_HANDLED
new text[128]
set_hudmessage(255,0,0,-1.0,0.3,0,1.0,1.0,0.0,0.0,38)
if ( AssasinAmount[id] <= 0 ) {
AssasinAmount[id] = 0
format(text, 127, "You have no teleports left" )
show_hudmessage( id, text)
playSoundDenySelect(id)
return PLUGIN_HANDLED
}
// Let them know they already used their ultimate if they have
if ( gPlayerUltimateUsed[id] ) {
playSoundDenySelect(id)
return PLUGIN_HANDLED
}
//Don't let them blink if they are planting the bomb
new wpnid, clip, ammo
wpnid = get_user_weapon(id, clip, ammo)
if (wpnid == CSW_C4 && Entvars_Get_Int(id, EV_INT_button)&IN_ATTACK) {
playSoundDenySelect(id)
return PLUGIN_HANDLED
}
AssasinAmount[id]--
if (AssasinAmount[id] <= 50) {
format(text, 127, "You have %d teleport%s left", AssasinAmount[id], AssasinAmount[id] == 1 ? "" : "s" )
show_hudmessage( id, text)
}
ultimateTimer(id, get_cvar_float("Assasin_cooldown"))
new Float:Assasindelay = get_cvar_float("Assasin_delay")
if (Assasindelay < 0.0) Assasindelay = 0.0
get_user_origin(id,AssasinSpot[id],3)
origAssasinSpot[id][0] = AssasinSpot[id][0]
origAssasinSpot[id][1] = AssasinSpot[id][1]
origAssasinSpot[id][2] = AssasinSpot[id][2]
if (get_cvar_num("Assasin_delaystuck")) {
shStun(id, floatround(Assasindelay, floatround_floor) + 1)
set_user_maxspeed(id, 1.0)
}
new flashtime = floatround(Assasindelay * 10)
if (flashtime > 12) flashtime = 12
if (flashtime < 8) flashtime = 8
shGlow(id, 219, 112, 147)
setScreenFlash(id, 219, 112, 147, flashtime, 60)
set_task(Assasindelay,"Assasin_teleport", id)
return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public Assasin_unglow(id) {
shUnglow(id)
}
//----------------------------------------------------------------------------------------------
public Assasin_teleport(id)
{
//Don't let them blink if they are planting the bomb
new wpnid, clip, ammo
wpnid = get_user_weapon(id, clip, ammo)
if (wpnid == CSW_C4 && Entvars_Get_Int(id, EV_INT_button)&IN_ATTACK) {
AssasinAmount[id]++
playSoundDenySelect(id)
return PLUGIN_HANDLED
}
emit_sound(id, CHAN_AUTO, "shmod/Assasin_teleport.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
AssasinSpot[id][2] += 45
set_user_origin(id,AssasinSpot[id])
checkCount[id] = 1
positionChangeTimer(id)
return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public positionChangeTimer(id)
{
if (!is_user_alive(id)) return
new Float:velocity[3]
get_user_origin(id, g_lastPosition[id])
Entvars_Get_Vector(id, EV_VEC_velocity, velocity)
if ( velocity[0]==0.0 && velocity[1]==0.0 ) {
// Force a Move (small jump)
velocity[0] += 20.0
velocity[2] += 100.0
Entvars_Set_Vector(id, EV_VEC_velocity, velocity)
}
set_task(0.2,"positionChangeCheck",id)
}
//----------------------------------------------------------------------------------------------
public positionChangeCheck(id)
{
if (!is_user_alive(id)) return
new origin[3]
get_user_origin(id, origin)
if ( g_lastPosition[id][0] == origin[0] && g_lastPosition[id][1] == origin[1] && g_lastPosition[id][2] == origin[2]) {
switch(checkCount[id]) {
case 0 : Assasin_movecheck(id, 0, 0, 0) // Original
case 1 : Assasin_movecheck(id, 0, 0, 80) // Up
case 2 : Assasin_movecheck(id, 0, 0, -110) // Down
case 3 : Assasin_movecheck(id, 0, 30, 0) // Forward
case 4 : Assasin_movecheck(id, 0, -30, 0) // Back
case 5 : Assasin_movecheck(id, -30, 0, 0) // Left
case 6 : Assasin_movecheck(id, 30, 0, 0) // Right
case 7 : Assasin_movecheck(id, -30, 30, 0) // Forward-Left
case 8 : Assasin_movecheck(id, 30, 30, 0) // Forward-Right
case 9 : Assasin_movecheck(id, -30, -30, 0) // Back-Left
case 10: Assasin_movecheck(id, 30, -30, 0) // Back-Right
case 11: Assasin_movecheck(id, 0, 30, 60) // Up-Forward
case 12: Assasin_movecheck(id, 0, 30, -110) // Down-Forward
case 13: Assasin_movecheck(id, 0, -30, 60) // Up-Back
case 14: Assasin_movecheck(id, 0, -30, -110) // Down-Back
case 15: Assasin_movecheck(id, -30, 0, 60) // Up-Left
case 16: Assasin_movecheck(id, 30, 0, 60) // Up-Right
case 17: Assasin_movecheck(id, -30, 0, -110) // Down-Left
case 18: Assasin_movecheck(id, 30, 0, -110) // Down-Right
default: user_kill(id)
}
return
}
set_task(1.0, "Assasin_unglow", id)
}
//----------------------------------------------------------------------------------------------
public Assasin_movecheck(id, mX, mY, mZ)
{
if ( !hasRoundStarted() ) return
AssasinSpot[id][0] = origAssasinSpot[id][0] + mX
AssasinSpot[id][1] = origAssasinSpot[id][1] + mY
AssasinSpot[id][2] = origAssasinSpot[id][2] + mZ
set_user_origin(id,AssasinSpot[id])
checkCount[id]++
positionChangeTimer(id)
}
//----------------------------------------------------------------------------------------------
and this is the errors
Code:
Warning: Loose indentation on line 144
Warning: Loose indentation on line 259
Warning: Loose indentation on line 326
Error: Undefined symbol "ghasAssasinPower" on line 493
Warning: Expression has no effect on line 493
Error: Expected token: ";", but found "]" on line 493
Error: Invalid expression, assumed zero on line 493
Error: Too many error messages on one line on line 493
Compilation aborted.
4 Errors.
|
|