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
 

Gacekk - zdjęcie

Gacekk

Rejestracja: 17.04.2014
Aktualnie: Nieaktywny
Poza forum Ostatnio: 28.02.2015 08:12
-----

Moje tematy

Przerobienie pluginu z HLDS 5787 na HLDS 6027+

28.01.2015 15:39

Witam mam mały problem z jednym pluginem otóż działa na starym silniku HLDS 5787 (Metamod-P 1.21p37, Amx Mod X 1.8.1 (stary), Dproto 0.9.322)

Natomiast na nowszym HLDS 6027+ (Metamod 1.20-am, Amx Mod X 1.8.2 2013, Dproto 0.9.322) nie działa w ogóle proszę o pomoc w przerobieniu tego pluginu tak żeby działał na nowym silniku.

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <cstrike>

#define PLUGIN	"sprite ESP"
#define AUTHOR	"DarkGL"
#define VERSION	"1.0"

const maxPlayers	=	32;

const Float: spriteDistance = 10.0;

new const spriteEnemy[]		=	"sprites/esp_enemy.spr";
new const spriteFriend[]	=	"sprites/esp_friend.spr";

new spriteEnemyIndex		=	0;
new spriteFriendIndex		=	0;

new const espClassName[]	=	"esp_info";

new temporarySprites[ maxPlayers + 1 ];

new bool:espON[ maxPlayers + 1 ];

public plugin_init(){
	
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_clcmd( "say /esp" , "espONOFF" );
	
	for( new iCurrent = 1 ; iCurrent <= maxPlayers ; iCurrent++ ){
		temporarySprites[ iCurrent ]	=	createSprite( iCurrent );
	}
	
	register_forward( FM_AddToFullPack , "addToFullPack" , 1 );
	
	register_forward( FM_CheckVisibility , "checkVisibility" );
}

public plugin_precache(){
	spriteEnemyIndex	=	precache_model( spriteEnemy );
	spriteFriendIndex	=	precache_model( spriteFriend );
}

public client_connect( id ){
	espON[ id ] = false;
}

public checkVisibility(id,pset){
	if( !pev_valid( id ) ){
		return FMRES_IGNORED;
	}
	
	new szClass[ 64 ];
	
	pev( id , pev_classname , szClass , charsmax( szClass ) );
	
	if( !equal( szClass , espClassName ) ){
		return FMRES_IGNORED;
	}
	
	forward_return(FMV_CELL,1)
	return FMRES_SUPERCEDE
}

public addToFullPack( es_state, e, ENT, HOST, hostflags, player, set){
	if( player || !is_user_alive( HOST ) ){
		return FMRES_IGNORED;
	}
	
	if( !pev_valid( ENT ) ){
		return FMRES_IGNORED;
	}
	
	new iOwner	=	pev( ENT , pev_owner );
	
	if( !is_user_alive( iOwner ) || !espON[ HOST ] || temporarySprites[ pev( ENT , pev_owner ) ] != ENT || iOwner == HOST ){
		return FMRES_IGNORED;
	}
	
	new Float: startPosition[ 3 ],
		Float: endPosition[ 3 ],
		Float: fEnd[ 3 ],
		Float: fVector[ 3 ],
		Float: fEndPosition[ 3 ],
		Float: endVector[ 3 ],
		Float: fLenNew,
		Float: fLenOld;
	
	calculateStartPosition( HOST , startPosition );
	calculateEndPosition( iOwner , endPosition );
	calculateVector( endPosition , startPosition , fVector );
	
	traceLine( startPosition , endPosition , fEnd , HOST );
	
	movePosition( fEnd , fVector , fEndPosition );
	
	calculateEndVector( startPosition , fEndPosition , endVector );
	
	fLenNew	=	xs_vec_len( endVector );
	fLenOld	=	xs_vec_len( fVector );
	
	set_es( es_state , ES_Origin , fEndPosition );
	set_es( es_state , ES_ModelIndex , isFriend( HOST , iOwner ) ? spriteFriendIndex : spriteEnemyIndex );
	set_es( es_state , ES_Scale ,  fLenNew / fLenOld );
	
	set_es( es_state, ES_RenderAmt , 255.0 );
	
	return FMRES_HANDLED;
}

public espONOFF( id ){
	if( !( get_user_flags( id ) & ADMIN_BAN ) ){
		return PLUGIN_HANDLED;
	}
	
	espON[ id ]	=	!espON[ id ];
	
	return PLUGIN_HANDLED;
}

createSprite( iOwner ){
	new iEnt	=	engfunc( EngFunc_CreateNamedEntity , engfunc( EngFunc_AllocString , "info_target" ) );
	
	if( !pev_valid( iEnt ) ){
		return 0;
	}
	
	set_pev( iEnt , pev_classname , espClassName );
	
	engfunc( EngFunc_SetSize , iEnt , Float:{ -1.0 , -1.0 , -1.0 } , Float:{ 1.0 , 1.0 , 1.0 } );
	engfunc( EngFunc_SetOrigin , iEnt , Float:{ 306.0 , 2434.0 , -91.0 } );
	
	engfunc( EngFunc_SetModel , iEnt , spriteEnemy );
	
	set_pev( iEnt, pev_renderfx, kRenderFxNone );
	set_pev( iEnt, pev_rendercolor, Float:{ 255.0 , 255.0 , 255.0 } );
	set_pev( iEnt, pev_rendermode, kRenderTransAlpha );
	set_pev( iEnt, pev_renderamt, 0.0 );
	
	set_pev( iEnt , pev_solid , SOLID_NOT );
	set_pev( iEnt , pev_movetype , MOVETYPE_NONE );
	
	set_pev( iEnt, pev_owner , iOwner );
	
	dllfunc(DLLFunc_Spawn, iEnt )
	
	return iEnt;
}

calculateStartPosition( id , Float: startPosition[ 3 ] ){
	new Float: fOrigin[ 3 ],
		Float: fView[ 3 ];
		
	pev( id , pev_origin , fOrigin );
	pev( id , pev_view_ofs , fView );
	
	xs_vec_add( fOrigin , fView , startPosition );
}

calculateEndPosition( id , Float: endPosition[ 3 ]  ){
	pev( id , pev_origin , endPosition );
}

traceLine( Float:startPosition[ 3 ] , Float:endPosition[ 3 ] , Float:fEnd[ 3 ] , idSkip ){
	new pTR	=	create_tr2();
	
	engfunc( EngFunc_TraceLine , startPosition , endPosition , IGNORE_MONSTERS , idSkip , pTR );
	
	get_tr2( pTR , TR_vecEndPos , fEnd );
	
	free_tr2( pTR );
}

calculateVector( Float:startPosition[ 3 ] , Float:endPosition[ 3 ] , Float:fVector[ 3 ] ){
	xs_vec_sub( endPosition , startPosition , fVector );
}

movePosition( Float: fPosition[ 3 ] , Float: fVector[ 3 ] , Float: fEndPosition[ 3 ] ){
	
	new Float: fVectorCopy[ 3 ];
	
	xs_vec_copy( fVector , fVectorCopy );
	
	xs_vec_normalize( fVectorCopy , fVectorCopy );
	
	xs_vec_mul_scalar( fVectorCopy , spriteDistance , fVectorCopy );
	
	xs_vec_add( fPosition , fVectorCopy , fEndPosition );
}

calculateEndVector( Float: startPosition[ 3 ] , Float: fEnd[ 3 ] , Float: fEndVector[ 3 ] ){
	xs_vec_sub( fEnd, startPosition , fEndVector );
}

bool: isFriend( idUser , idUser2 ){
	return cs_get_user_team( idUser ) == cs_get_user_team( idUser2 );
}

[ROZWIĄZANE] spawnprotection error set_user_godmode

09.12.2014 18:30

Witam, prosił bym o pomoc z ciągłymi errorami sma pluginu:

 

Spoiler

 

 

 

errory :

L 12/09/2014 - 12:07:23: [AMXX] Displaying debug trace (plugin "spawn_protection_pl2.amxx")
L 12/09/2014 - 12:07:23: [AMXX] Run time error 10: native error (native "set_user_godmode")
L 12/09/2014 - 12:07:23: [AMXX]    [0] spawn_protection_pl2.sma::player_damage (line 202)
L 12/09/2014 - 12:07:37: [FUN] Player out of range (70)

Bardzo bym prosił o rade jak pozbyć się errorów

[ROZWIĄZANE] Run time error 4: index out of bounds (jak naprawić)

28.04.2014 20:05

Witam w wielu klasach wywala mi errory :

L 04/28/2014 - 17:42:43: [AMXX] Displaying debug trace (plugin "codclass_gacek.amxx")
L 04/28/2014 - 17:42:43: [AMXX] Run time error 4: index out of bounds 
L 04/28/2014 - 17:42:43: [AMXX]    [0] codclass_gacek.sma::DeathMsg (line 89)

Nie potrafie tego naprawić sma jednej z wielu klas z tym errorem:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <codmod>
#include <fakemeta>
#include <hamsandwich>

new const nazwa[] = "Gacek (Klasa Premium)";
new const opis[] = "20 hp oraz pelen magazynak za kazde zabojstwo, Posiada eliminator rozrzutu";
new const bronie = 1<<CSW_M4A1 | 1<<CSW_AK47;
new const zdrowie = 30;
new const kondycja = 38;
new const inteligencja = 10;
new const wytrzymalosc = 20;

new bool:ma_klase[33];

new bool:moze_skoczyc[33];

new const maxClip[31] = { -1, 13, -1, 10,  1,  7,  1,  30, 30,  1,  30,  20,  25, 30, 35, 25,  12,  20, 
10,  30, 100,  8, 30,  30, 20,  2,  7, 30, 30, -1,  50 };

public plugin_init() {
	register_plugin(nazwa, "1.0", "QTM_Peyote");
	
	cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
	
	register_forward(FM_PlayerPreThink, "PreThink");
	register_forward(FM_UpdateClientData, "UpdateClientData", 1)
	register_forward(FM_CmdStart, "CmdStart");
	register_event("DeathMsg", "DeathMsg", "ade");
}

public cod_class_enabled(id)
{
	if(!(get_user_flags(id) & ADMIN_LEVEL_F))
	{
		client_print(id, print_chat, "[Gacek] Nie masz uprawnien, aby uzywac tej klasy.")
		return COD_STOP;
	}
	ma_klase[id] = true;
	return COD_CONTINUE;
}

public PreThink(id)
{
	if(ma_klase[id])
		set_pev(id, pev_punchangle, {0.0,0.0,0.0})
}
public UpdateClientData(id, sw, cd_handle)
{
	if(ma_klase[id])
		set_cd(cd_handle, CD_PunchAngle, {0.0,0.0,0.0})   
}

public cod_class_disabled(id)
	ma_klase[id] = false;

public CmdStart(id, uc_handle)
{
	if(!ma_klase[id])
		return FMRES_IGNORED;
	
	new button = get_uc(uc_handle, UC_Buttons);
	new oldbutton = pev(id, pev_oldbuttons);
	new flags = pev(id, pev_flags);
	if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && moze_skoczyc[id])
	{
		moze_skoczyc[id] = false;
		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] = true;
		
	return FMRES_IGNORED;
}

public DeathMsg()
{
	new killer = read_data(1);
	new victim = read_data(2);
	
	if(!is_user_connected(killer))
		return PLUGIN_CONTINUE;
	
	if(ma_klase[victim] && !ma_klase[killer])
		cod_set_user_xp(killer, cod_get_user_xp(killer)+10);
	
	if(ma_klase[killer])
	{
		new cur_health = pev(killer, pev_health);
		new Float:max_health = 100.0+cod_get_user_health(killer);
		new Float:new_health = cur_health+20.0<max_health? cur_health+20.0: max_health;
		set_pev(killer, pev_health, new_health);
		
		new weapon = get_user_weapon(killer);
		if(maxClip[weapon] != -1)
			set_user_clip(killer, maxClip[weapon]);
	}
	
	
	return PLUGIN_CONTINUE;
}

stock set_user_clip(id, ammo)
{
	new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
	get_weaponname(weapon, weaponname, 31);
	while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
		if (pev(weaponid, pev_owner) == id) {
		set_pdata_int(weaponid, 51, ammo, 4);
		return weaponid;
	}
	return 0;
}

Kto powie jak naprawić ten problem w klasach.