Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

revoolution - zdjęcie

revoolution

Rejestracja: 29.12.2010
Aktualnie: Nieaktywny
Poza forum Ostatnio: 22.12.2021 15:54
-----

Moje tematy

client_PreThink

20.01.2014 21:01

A więc tak, przy debugu :

L 01/20/2014 - 21:04:51: [] Run time error 4: index out of bounds 
L 01/20/2014 - 21:04:51: [] [0] GWM.sma::client_PreThink (line 1217)
L 01/20/2014 - 21:10:32: [] Run time error 4: index out of bounds 
L 01/20/2014 - 21:10:32: [] [0] GWM.sma::CmdStart (line 1727)

public z linia 1727 :

public CmdStart(id, uc_handle)
{
	if(!is_user_alive(id))	return FMRES_IGNORED;

	new button = get_uc(uc_handle, UC_Buttons);
	new oldbutton = get_user_oldbutton(id);
	new flags = get_entity_flags(id);

	if(informacje_przedmiotu_gracza[id][0] == 11)
	{
		if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && ilosc_skokow_gracza[id] > 0)
		{
			ilosc_skokow_gracza[id]--;
			new Float:velocity[3];
			entity_get_vector(id,EV_VEC_velocity,velocity);
			velocity[2] = random_float(265.0,285.0);
			entity_set_vector(id,EV_VEC_velocity,velocity);
		}
		else if(flags & FL_ONGROUND)
		{       
			ilosc_skokow_gracza[id] = 1;
		}
	}


	if(button & IN_ATTACK)
	{
		new Float:fPunch[3] = {0.0,0.0,0.0};
		
		if(informacje_przedmiotu_gracza[id][0] == 20)	entity_set_vector(id, EV_VEC_punchangle,fPunch);
		
		if(informacje_przedmiotu_gracza[id][0] == 23)
		{
			entity_get_vector(id, EV_VEC_punchangle, fPunch);
			
			for(new i=0; i<3;i++) fPunch[i]*=0.9;
			
			entity_set_vector(id, EV_VEC_punchangle, fPunch);
		}
	}

	if(informacje_przedmiotu_gracza[id][0] == 28 && button & IN_DUCK && button & IN_JUMP && flags & FL_ONGROUND && get_gametime() > informacje_przedmiotu_gracza[id][1]+4.0){
		informacje_przedmiotu_gracza[id][1] = floatround(get_gametime());
		new Float:velocity[3];
		VelocityByAim(id, 700, velocity);
		velocity[2] = random_float(265.0,285.0);
		entity_set_vector(id, EV_VEC_velocity, velocity);
	}

	static moze_skoczyc[MAX+1];

	if(informacje_przedmiotu_gracza[id][0] == 52){
		
		if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && moze_skoczyc[id] > 0)
		{
			moze_skoczyc[id]--;
			new Float:velocity[3];
			pev(id, pev_velocity, velocity);
			velocity[2] = random_float(265.0,285.0);
			set_pev(id, pev_velocity, velocity);
		}
		else if(flags & FL_ONGROUND){
			moze_skoczyc[id] = 4;
		}
	}

	if(informacje_przedmiotu_gracza[id][0] == 58 && !(oldbutton & IN_JUMP)){
		
		if(button & IN_DUCK){
			set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 76);
		}
		else {
			set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
		}
	}

	if(button & IN_USE && !(oldbutton & IN_USE) && informacje_przedmiotu_gracza[id][0] == 59 && godmode[id]){
		godmode[id] = false;
		set_user_godmode(id,1);
		set_task(4.0,"godmode_off2",id+993213)
		set_bartime(id,4,0);
	}

	if(klasa_gracza[id] == screaming && pev(id,pev_button) & IN_USE && !(pev(id,pev_oldbuttons) & IN_USE)){
		moc_talic(id);
	}

	if(klasa_gracza[id] == zmechanizowany && (get_speed(id) > 50|| gUserTempe[id] >= 255) && get_user_weapon(id) == CSW_M249){
		setAttackAttack2(id)
	}

	if(get_pdata_cbase(id,OFFSET_ACTIVEITEM,OFFSET_LINUX_PLAYER) == gEntBaz[id]){
		if(get_user_button(id) & IN_ATTACK && gNextShotTime[id] <= get_gametime() && ilosc_rakiet_gracza[id] > 0){
			gNextShotTime[id] = get_gametime() + 3.0;
			StworzRakiete(id);
			set_animation(id,3)
			new wpn[32],clip,ammo,wpnid;
			wpnid = get_user_weapon(id, clip, ammo)
			get_weaponname(wpnid,wpn,31)
			
			cs_set_user_bpammo(id,wpnid,0)
			
			cs_set_weapon_ammo(find_ent_by_owner(1, wpn, id ), ilosc_rakiet_gracza[id]);
			
			FX_UpdateClip(id,get_user_weapon(id),ilosc_rakiet_gracza[id]);
		}
		setAttackAttack2(id)
	}
	
	if( get_user_button(id) & IN_ATTACK2 && !(get_user_oldbutton(id) & IN_ATTACK2) && klasa_gracza[id] == sas) 
	{			
		if (get_user_weapon(id) == CSW_KNIFE)
		{
			if (halflife_time()-player_b_blink[id] <= 3) return PLUGIN_HANDLED		
			player_b_blink[id] = floatround(halflife_time())	
			UTIL_Teleport(id,180+12*inteligencja_gracza[id])			
		}
	}
	if (entity_get_int(id, EV_INT_button) & 2 && informacje_przedmiotu_gracza[id][0] == 44){
		new flags = entity_get_int(id, EV_INT_flags)
		
		if (!(flags & FL_WATERJUMP) && entity_get_int(id, EV_INT_waterlevel) < 2 && flags & FL_ONGROUND){
			new Float:velocity[3]
			entity_get_vector(id, EV_VEC_velocity, velocity)
			velocity[2] += 250.0
			entity_set_vector(id, EV_VEC_velocity, velocity)
			entity_set_int(id, EV_INT_gaitsequence, 6)
		}
	}

	if( (button & IN_JUMP) && !(oldbutton & IN_JUMP) && (flags & FL_ONGROUND) && !(flags & FL_INWATER) && klasa_gracza[id] == rangers) {
		static Float:vecforce[3]
		pev(id,pev_velocity,vecforce)
		vecforce[2] += 400.0;
		set_pev(id,pev_velocity,vecforce)
	}

	if(iNiewi[id] == 1 && informacje_przedmiotu_gracza[id][0] == 66 && is_user_alive(id) && button & IN_USE && !(oldbutton & IN_USE)){
		set_bartime(id,5,0);
		
		iNiewi[id] = 0;
		set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 10);
		remove_task(id+46466)
		set_task(5.0,"offNiewi",id+46466)
	}

	if (has_parachute[id]){
		
		new Float:fallspeed = get_pcvar_float(pFallSpeed) * -1.0
		new Float:frame
		
		new button = get_user_button(id)
		new oldbutton = get_user_oldbutton(id)
		new flags = get_entity_flags(id)
		
		if (para_ent[id] > 0 && (flags & FL_ONGROUND))
		{
			if (get_pcvar_num(pDetach))
			{	
				if (fm_get_user_gravity(id) == 0.1) fm_set_user_gravity(id, 1.0)
				
				if (entity_get_int(para_ent[id],EV_INT_sequence) != 2)
				{
					entity_set_int(para_ent[id], EV_INT_sequence, 2)
					entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
					entity_set_float(para_ent[id], EV_FL_frame, 0.0)
					entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
					entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
					entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
					return FMRES_IGNORED;
				}
				
				
				frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
				entity_set_float(para_ent[id],EV_FL_fuser1,frame)
				entity_set_float(para_ent[id],EV_FL_frame,frame)
				
				if (frame > 254.0)
				{
					remove_entity(para_ent[id])
					para_ent[id] = 0
				}
			}
			else
			{
				remove_entity(para_ent[id])
				fm_set_user_gravity(id, 1.0)
				para_ent[id] = 0
			}
		}
		else if (button & IN_USE)
		{
			new Float:velocity[3]
			entity_get_vector(id, EV_VEC_velocity, velocity)
			
			if (velocity[2] < 0.0)
			{	
				if(para_ent[id] <= 0)
				{
					para_ent[id] = create_entity("info_target")
					if(para_ent[id] > 0)
					{
						entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
						entity_set_edict(para_ent[id], EV_ENT_aiment, id)
						entity_set_edict(para_ent[id], EV_ENT_owner, id)
						entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
						entity_set_model(para_ent[id], "models/gwm_mod/parachute.mdl")
						entity_set_int(para_ent[id], EV_INT_sequence, 0)
						entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
						entity_set_float(para_ent[id], EV_FL_frame, 0.0)
						entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
					}
				}
				if (para_ent[id] > 0)
				{
					entity_set_int(id, EV_INT_sequence, 3)
					entity_set_int(id, EV_INT_gaitsequence, 1)
					entity_set_float(id, EV_FL_frame, 1.0)
					entity_set_float(id, EV_FL_framerate, 1.0)
					fm_set_user_gravity(id, 0.1)
					
					velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
					entity_set_vector(id, EV_VEC_velocity, velocity)
					
					if (entity_get_int(para_ent[id],EV_INT_sequence) == 0)
					{	
						frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
						entity_set_float(para_ent[id],EV_FL_fuser1,frame)
						entity_set_float(para_ent[id],EV_FL_frame,frame)
						
						if (frame > 100.0)
						{
							entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
							entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
							entity_set_int(para_ent[id], EV_INT_sequence, 1)
							entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
							entity_set_float(para_ent[id], EV_FL_frame, 0.0)
							entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
						}
					}
				}
			}
			else if (para_ent[id] > 0)
			{
				remove_entity(para_ent[id])
				fm_set_user_gravity(id, 1.0)
				para_ent[id] = 0
			}
		}
		else if ((oldbutton & IN_USE) && para_ent[id] > 0 )
		{
			remove_entity(para_ent[id])
			fm_set_user_gravity(id, 1.0)
			para_ent[id] = 0
		}
	}

	return FMRES_IGNORED;
}

public z linia 1217 : 

public client_PreThink(id){
	if(!is_user_alive(id))	return PLUGIN_CONTINUE;
	
	if(klasa_gracza[id] == zmechanizowany && (get_speed(id) > 50|| gUserTempe[id] >= 255) && get_user_weapon(id) == CSW_M249){
		setAttackAttack2(id)
	}

	if(get_pdata_cbase(id,OFFSET_ACTIVEITEM,OFFSET_LINUX_PLAYER) == gEntBaz[id]){
		setAttackAttack2(id)
	}
	if(get_pdata_cbase(id,OFFSET_ACTIVEITEM,OFFSET_LINUX_PLAYER) == gEntExplode[id]){
		setAttackAttack2(id)
	}
	
	#if defined CSS_ZOOM
	if(g_doFov[id])
	{
		if(g_MinMaxFov[id][1] > g_MinMaxFov[id][0])
		{
			--g_MinMaxFov[id][1]
			message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)
			write_byte(--g_MinMaxFov[id][1])
			message_end()
		}
		else
		{
			message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)
			write_byte(g_MinMaxFov[id][0])
			message_end()
			g_doFov[id] = 0
		}
	}
	#endif
	
	return PLUGIN_CONTINUE;
}

Zmiana zasięgu dynamitu

20.01.2014 16:51

Podejrzewam że można zmienić w parametrach poniżej.

 

Chodzi o to, że dynamit ma zbyt duży zasięg (głównie w pionie) - zabija nawet osoby w pokoju ponad.

public PolozDynamit(id)
{
	if(!ilosc_dynamitow_gracza[id])
	{
		client_print(id, print_center, "Wykorzystales juz caly dynamit!");
		return PLUGIN_CONTINUE;
	}
	
	if(inteligencja_gracza[id] < 1)
	client_print(id, print_center, "Aby wzmocnic dynamit, zwieksz inteligencje!");
	
	ilosc_dynamitow_gracza[id]--;
	new Float:fOrigin[3], iOrigin[3];
	entity_get_vector( id, EV_VEC_origin, fOrigin);
	iOrigin[0] = floatround(fOrigin[0]);
	iOrigin[1] = floatround(fOrigin[1]);
	iOrigin[2] = floatround(fOrigin[2]);
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY, iOrigin);
	write_byte(TE_EXPLOSION);
	write_coord(iOrigin[0]);
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2]);
	write_short(sprite_blast);
	write_byte(32);
	write_byte(20);
	write_byte(0);
	message_end();
	
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
	write_byte( TE_BEAMCYLINDER );
	write_coord( iOrigin[0] );
	write_coord( iOrigin[1] );
	write_coord( iOrigin[2] );
	write_coord( iOrigin[0] );
	write_coord( iOrigin[1] + 300 );
	write_coord( iOrigin[2] + 300 );
	write_short( sprite_white );
	write_byte( 0 ); // startframe
	write_byte( 0 ); // framerate
	write_byte( 10 ); // life
	write_byte( 10 ); // width
	write_byte( 255 ); // noise
	write_byte( 255 ); // r, g, b
	write_byte( 100 );// r, g, b
	write_byte( 100 ); // r, g, b
	write_byte( 128 ); // brightness
	write_byte( 8 ); // speed
	message_end();
	
	new entlist[MAX+1];
	new numfound = find_sphere_class(id, "player", 300.0 , entlist, 32);
	
	for (new i=0; i < numfound; i++)
	{               
		new pid = entlist[i];
		
		if (!is_user_alive(pid) || get_user_team(id) == get_user_team(pid) || informacje_przedmiotu_gracza[pid][0] == 24){
			continue;
		}
		ExecuteHam(Ham_TakeDamage, pid, 0, id, 60.0+float(inteligencja_gracza[id]) , 1);
	}
	return PLUGIN_CONTINUE;
}

[ROZWIĄZANE] simple_redirect i wyjątek dla Adminów

14.01.2014 18:18

Witam,

plugin jest przerobiony - przekierowuje graczy przy konkretnej ilości na serwerze.

 

Mam natomiast inny problem, co w kodzie jest skopane, że adminów i osoby z flagą "b", czyli rezerwacją, również przenosi ?

 

Chciałbym, aby redirect działał tylko na osoby bez zarezerwowanego slota.

/* AMXX Mod Script
*
* Simple Redirection Plugin for AMXX
* Orginal Code by Sonic ([email protected])
* Modified and Made for AMXX by BigBaller
*
*  Place following cvars in server.cfg
*
*  amx_rd_maxplayers <x>             // - begin redirection when more the x ppl connected ( 0 = redirect all players )
*  amx_rd_server <ip>                // - redirect to this server
*  amx_rd_serverport <port>          // - redirect server port
*  amx_rd_serverpw <password>        // - password for the amx_rd_server (if needed)
*
*
*  To Disable this plugin set amx_rd_maxppl to 33 or remove from plugins.ini
*/

#include <amxmodx>
#include <amxmisc>

public plugin_init() {
	register_plugin("Simple Redirect","1.0","BigBaller")
	register_cvar("amx_rd_maxplayers","0")

	register_cvar("amx_rd_server","")
	register_cvar("amx_rd_serverport","")
	register_cvar("amx_rd_serverpw","")
}

public client_connect(id){
    new rd_maxplayers = get_cvar_num("amx_rd_maxplayers")
    new rd_serverport = get_cvar_num("amx_rd_serverport")
    new rd_server[64], rd_serverpw[32]
    get_cvar_string("amx_rd_server",rd_server,63)
    get_cvar_string("amx_rd_serverpw",rd_serverpw,31)
    if ( get_playersnum() >= rd_maxplayers && !access(id,ADMIN_RESERVATION)) {
        if ( !equal(rd_serverpw,"") )
            client_cmd(id,"echo ^"Simple Redirection - Set Password to %s^";^"password^" %s",rd_serverpw,rd_serverpw)
        client_cmd(id,"echo ^"Simple Redirection -  Redirecting to %s:%d^";^"Connect^" %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
    }
    return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/