AdminMod.de
https://www.adminmod.de/

Superher geschrieben
https://www.adminmod.de/viewtopic.php?t=7346
Seite 1 von 1

Autor:  Greenberet1989 [ 31.07.2003, 21:32 ]
Betreff des Beitrags:  Superher geschrieben

hi,
ich hab mit Asskicr einen helden gescriptet, aber es gibt da ein Problem mit ihm
Jedesmal wenn ich seine Macht benutzen will (Rakete) dann startet er die Attacke nicht.
in der Konsole steht dann
Code:
[AMX]runtime error 10 on line 105(sh_goku.amx)
Wenn ich jetzt vor diese Zeile "//" mache dann kommt das Selbe Problem wieder un in der konsole steht
Code:
[AMX]runtime error 10 on line 106(sh_goku.amx)
Wenn ich jetzt vor diese Zeile "//" mache dann dann startet er die Rakete aber genau in der Mitte von der Map und sie bleibt dann dort.

HIer die sma
Code:
#include <amxmod> 
#include <amxmisc>
#include <Vexd_Utilities>
#include <xtrafun> 
#include <superheromod> 

new beam, boom
new gHeroName[]="Goku" 
new bool:g_hasGokuPower[SH_MAXSLOTS+1] 
new smoke, fire 

public plugin_init(){ 
  register_plugin("SUPERHERO Son-Goku","1.2","Greenberet/AssKicR") 

  // FIRE THE EVENT TO CREATE THIS SUPERHERO! 
  if (!cvar_exists("goku_level")) register_cvar("goku_level", "10" ) 
  shCreateHero(gHeroName, "Sajajin power", "More HP and AP, Kamehameha, very fast, and fly(work in progress)", true, "goku_level" ) 

  // KEY DOWN 
  register_srvcmd("goku_kd", "Vexd_CreateRocket") 
  shRegKeyDown(gHeroName, "goku_kd")
 
  // INIT 
  register_srvcmd("goku_init", "goku_init") 
  shRegHeroInit(gHeroName, "goku_init") 

  //Cvars
  register_cvar("goku_level", "10" )
  register_cvar("goku_armor", "700" )
  register_cvar("goku_health", "500" )
  register_cvar("goku_speed", "600" )
  register_cvar("goku_radius", "75" ) 
  register_cvar("goku_maxdamage", "200" ) 

  // Let Server know about Som-Gokus Variable
  // It is possible that another hero has more hps, less gravity, or more armor
  // so rather than just setting these - let the superhero module decide each round
  shSetMaxHealth(gHeroName, "goku_health" )
  shSetMaxArmor(gHeroName, "goku_armor" )
  shSetMaxSpeed(gHeroName, "goku_speed", "[0]" )
}

public goku_init() 
{ 
new temp[128] 
// First Argument is an id 
read_argv(1,temp,5) 
new id=str_to_num(temp) 

// 2nd Argument is 0 or 1 depending on whether the id has Som-Gokus powers 
read_argv(2,temp,5) 
new hasPowers=str_to_num(temp) 
g_hasGokuPower[id]=(hasPowers != 0)

if (!g_hasGokuPower[id]) 
{
    shRemHealthPower(id)
    shRemArmorPower(id)
    shRemSpeedPower(id)
  }
} 

public vexd_pfntouch(pToucher, pTouched) {
	new szClassName[32]
	Entvars_Get_String(pToucher, EV_SZ_classname, szClassName, 32);

	if(equal(szClassName, "vexd_rocket")) {
		emit_sound(pToucher, CHAN_WEAPON, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) 
		emit_sound(pToucher, CHAN_VOICE, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) 

		new iOwner
		iOwner = Entvars_Get_Edict(pToucher, EV_ENT_owner)

		new Float:vExplodeAt[3]
		Entvars_Get_Vector(pToucher, EV_VEC_origin, vExplodeAt)

		blowUp( iOwner, vExplodeAt )
		//RadiusDamage(vExplodeAt, 1, 50)

		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(3)
		write_coord(floatround(vExplodeAt[0]))
		write_coord(floatround(vExplodeAt[1]))
		write_coord(floatround(vExplodeAt[2]))
		write_short(boom)
		write_byte(50)
		write_byte(15)
		write_byte(0)
		message_end()

		AttachView(iOwner, iOwner)	//Resets rocket owner's view (in case of vrocket).

		RemoveEntity(pToucher)
	}

	return 1;
}

public Vexd_CreateRocket(id,level,cid){ 
	if (!cmd_access(id,level,cid,1)) 
		return PLUGIN_HANDLED

	new Float:vOrigin[3]
	new Float:vAngles[3]
	Entvars_Get_Vector(id, EV_VEC_origin, vOrigin)
	Entvars_Get_Vector(id, EV_VEC_v_angle, vAngles)

        new NewEnt
        NewEnt = CreateEntity("info_target")

        if(NewEnt == 0) {
            return PLUGIN_HANDLED_MAIN
        }

	Entvars_Set_String(NewEnt, EV_SZ_classname, "vexd_rocket")

        ENT_SetModel(NewEnt, "models/rpgrocket.mdl")

	new Float:MinBox[3]
	new Float:MaxBox[3]
	MinBox[0] = -1.0
	MinBox[1] = -1.0
	MinBox[2] = -1.0
	MaxBox[0] = 1.0
	MaxBox[1] = 1.0
	MaxBox[2] = 1.0

	Entvars_Set_Vector(NewEnt, EV_VEC_mins, MinBox)
	Entvars_Set_Vector(NewEnt, EV_VEC_maxs, MaxBox)

	ENT_SetOrigin(NewEnt, vOrigin)
	Entvars_Set_Vector(NewEnt, EV_VEC_angles, vAngles)

	Entvars_Set_Int(NewEnt, EV_INT_effects, 64)  //64 = EF_LIGHT, rocket glow. 64??
	Entvars_Set_Int(NewEnt, EV_INT_solid, 2)    //2 = Solid bbox. (const.h)
	Entvars_Set_Int(NewEnt, EV_INT_movetype, 5) //5 = movetype_fly, No grav, but collides.
	Entvars_Set_Edict(NewEnt, EV_ENT_owner, id)


	new Float:fNewVelocity[3] 
	VelocityByAim(id, 400, fNewVelocity)
	Entvars_Set_Vector(NewEnt, EV_VEC_velocity, fNewVelocity)

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(22) 
	write_short(NewEnt) 
	write_short(beam) 
	write_byte(45) 
	write_byte(4) 
	write_byte(255) 
	write_byte(0) 
	write_byte(0) 
	write_byte(128)
	message_end() 

	emit_sound(NewEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	emit_sound(NewEnt, CHAN_VOICE, "weapons/rocket1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

	return PLUGIN_HANDLED_MAIN
}


public plugin_precache() {
	precache_sound("vox/_period.wav")
	precache_sound("weapons/qkame.wav") 
	precache_sound("weapons/attackfly.wav") 
	precache_model("models/rpgrocket.mdl")
	beam = precache_model("sprites/laserbeam.spr")
	boom = precache_model("sprites/zerogxplode.spr")
	smoke = precache_model("sprites/steam1.spr") 
	fire = precache_model("sprites/explode1.spr") 
	return PLUGIN_CONTINUE 
}

public blowUp( id, Float:vExplodeAt[3] )
{ 
   new distanceBetween
   new damage, multiplier
   
   new name[32] 
   get_user_name(id,name,31) 
   set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
   new FFOn= get_cvar_num("mp_friendlyfire")
   new origin[3] 
   origin[0]=floatround(vExplodeAt[0])
   origin[1]=floatround(vExplodeAt[1])
   origin[2]=floatround(vExplodeAt[2])+37
   
   explode(origin) // blowup even if dead
   
   for(new a = 1; a <= SH_MAXSLOTS; a++) 
   { 
     if( is_user_alive(a) && ( get_user_team(id) != get_user_team(a) || FFOn != 0 || a==id ) )
     {
       new origin1[3]
       get_user_origin(a,origin1) 
       distanceBetween = get_distance(origin, origin1 )
       if( distanceBetween < get_cvar_num("goku_radius") )
       {
         multiplier=(get_cvar_num("goku_maxdamage")*get_cvar_num("goku_maxdamage"))/get_cvar_num("goku_radius")
         damage=(get_cvar_num("goku_radius")-distanceBetween)*multiplier
         damage=sqrt(damage)
         shExtraDamage(a, id, damage, "Kamehameha")
       } // distance
     } // alive target...
   } // loop    
}
//---------------------------------------------------------------------------------------------- 
public explode( vec1[3] )
{ 
   //Explosion2 
   message_begin( MSG_BROADCAST,SVC_TEMPENTITY) 
   write_byte( 12 ) 
   write_coord(vec1[0]) 
   write_coord(vec1[1]) 
   write_coord(vec1[2]) 
   write_byte( 188 ) // byte (scale in 0.1's) 188 
   write_byte( 10 ) // byte (framerate) 
   message_end() 

   //TE_Explosion 
   message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
   write_byte( 3 ) 
   write_coord(vec1[0]) 
   write_coord(vec1[1]) 
   write_coord(vec1[2]) 
   write_short( fire ) 
   write_byte( 60 ) // byte (scale in 0.1's) 188 
   write_byte( 10 ) // byte (framerate) 
   write_byte( 0 ) // byte flags 
   message_end() 


   //Smoke 
   message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
   write_byte( 5 ) // 5 
   write_coord(vec1[0]) 
   write_coord(vec1[1]) 
   write_coord(vec1[2]) 
   write_short( smoke ) 
   write_byte( 10 )  // 2 
   write_byte( 10 )  // 10 
   message_end() 
} 
//---------------------------------------------------------------------------------------------- 

Autor:  Greenberet1989 [ 04.08.2003, 12:11 ]
Betreff des Beitrags: 

Weiß keiner wo der Fehler ist?

Autor:  TheHidden [ 04.08.2003, 13:14 ]
Betreff des Beitrags: 

Hi

Woher kommt den die ID, wer uebergibt sie.
Du registrierst nur den Aufruf zur Funktion aber mit welchen Parametern wird die Funktion denn aufgerufen?

Das solltes du mal überprüfen, wahrscheinlich liegt es dadran ( Falsche ID )

TheHidden

Seite 1 von 1 Alle Zeiten sind UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/