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 ); }