23/06/2014, 07:37 PM
(23/06/2014, 07:31 PM)Pipa Roja escribió: [ -> ]Una consulta que ago si alguien roba un plugin y lo postea en este foro?
http://amxmodx-es.com/Thread-APORTE-Regalo
Lo único que cambio es Health a Money
Original:
Código PHP:#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#define MEDKIT_MINSZ Float:{ -23.160000, -13.660000, -0.050000 }
#define MEDKIT_MAXSZ Float:{ 11.470000, 12.780000, 6.720000 }
#define MODEL_KIT "models/evolution/kit.mdl"
#define SOUND_KIT "items/smallmedkit1.wav"
#define FFADE_IN 0x0000
new gToggleKitEnable;
new gToggleGlowShow;
new gGMsgFade;
new gToggleFadeEnable;
new gToggleRemoveAtRstart;
new gKitHealthCvar;
new gLimitHealthCvar;
new gGMsgItemPickup;
new const gMedKitClassname[] = "medkit_entity";
public plugin_init() {
register_event( "DeathMsg","drop_kit","a" );
register_logevent( "logevent_round_start", 2, "1=Round_Start" );
register_forward( FM_Touch,"ForwardTouch" );
gToggleKitEnable = register_cvar( "kit_enable", "1" );
gToggleGlowShow = register_cvar( "kit_glow", "1" );
gToggleFadeEnable = register_cvar( "kit_fade", "1" );
gToggleRemoveAtRstart = register_cvar( "kit_remove", "1" );
gKitHealthCvar = register_cvar( "kit_health", "20" );
gLimitHealthCvar = register_cvar( "kit_limit_health", "999" );
gGMsgFade = get_user_msgid( "ScreenFade" );
gGMsgItemPickup = get_user_msgid( "ItemPickup" );
}
public plugin_precache() {
precache_model( MODEL_KIT );
precache_sound( SOUND_KIT );
}
public drop_kit()
{
/* --| Check if plugin is enabled/disabled */
if( get_pcvar_num( gToggleKitEnable ) == 0 )
{
return PLUGIN_HANDLED;
}
/* --| Get the victim id */
new victim = read_data( 2 );
/* --| Get the victim origin */
static Float:origin[ 3 ];
pev( victim, pev_origin, origin );
/* --| Creating healthkit entity */
new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
/* --| Modify the origin a little bit. This is calculated to be set on floor */
origin[ 2 ] -= 36;
/* --| Setting the ent origin */
engfunc( EngFunc_SetOrigin, ent, origin );
/* --| Check if isn't a valid ent */
if( !pev_valid( ent ) )
{
return PLUGIN_HANDLED;
}
/* --| Now let's set the entity model and some stuff */
set_pev( ent, pev_classname, gMedKitClassname );
set_pev(ent, pev_solid, SOLID_NOT )
engfunc( EngFunc_SetModel, ent, MODEL_KIT );
dllfunc( DLLFunc_Spawn, ent );
set_pev( ent, pev_solid, SOLID_BBOX );
set_pev( ent, pev_movetype, MOVETYPE_NONE );
engfunc( EngFunc_SetSize, ent, MEDKIT_MINSZ, MEDKIT_MAXSZ );
engfunc( EngFunc_DropToFloor, ent );
/* --| If cvar is set to 1, let's glow the entity */
if( get_pcvar_num( gToggleGlowShow ) == 1 )
{
fm_set_rendering( ent, kRenderFxGlowShell, 255, 255, 255, kRenderFxNone, 27 );
}
return PLUGIN_HANDLED;
}
/* --| Calling the touch forward from fakemeta to see if player touched the entity */
public ForwardTouch( ent, id )
{
/* --| Check if is a valid entity and is plugin enabled */
if( !pev_valid( ent ) || get_pcvar_num( gToggleKitEnable ) == 0 )
{
return FMRES_IGNORED;
}
/* --| Find the ent classname */
new classname[ 32 ];
pev( ent, pev_classname, classname, charsmax( classname ) );
/* --| Check if isn't our classname */
if( !equal( classname, gMedKitClassname ) )
{
return FMRES_IGNORED;
}
/* --| Get the user health, and check some cvars */
new health = get_user_health( id );
new cvarhealth = get_pcvar_num( gKitHealthCvar );
new maxhealth = get_pcvar_num( gLimitHealthCvar );
/* --| Check player health */
if( health >= maxhealth )
{
client_print( id, print_center, " Ya tienes Mucha Vida");
return FMRES_IGNORED;
}
/* --| Show a red hud message to client */
set_hudmessage( 255, 0, 0, -1.0, 0.83, 2, 6.0, 3.0 );
show_hudmessage( id, "Recogiste %d Kits", cvarhealth );
/* Set the health and show some minor things, for fun */
fm_set_user_health( id, health + cvarhealth );
emit_sound( id, CHAN_ITEM, SOUND_KIT, VOL_NORM, ATTN_NORM ,0 , PITCH_NORM );
/* --| Show the healthkit item on hud */
message_begin( MSG_ONE_UNRELIABLE, gGMsgItemPickup, _, id );
write_string( "item_healthkit" );
message_end();
/* --| If cvar for fade is enabled, let's create the fade */
if( get_pcvar_num( gToggleFadeEnable ) == 1 )
{
message_begin( MSG_ONE_UNRELIABLE, gGMsgFade , _, id );
write_short( 1<<10 );
write_short( 1<<10 );
write_short( FFADE_IN );
write_byte( 255 );
write_byte( 0 );
write_byte( 0 );
write_byte( 75 );
message_end();
}
/* --| Now we need to remove the entity from floor */
engfunc( EngFunc_RemoveEntity, ent );
return FMRES_IGNORED;
}
/* --| Round start, we need to check entity and remove it */
public logevent_round_start()
{
/* --| If cvar to remove ent on round start is enabled, let's remove the ent */
if( get_pcvar_num( gToggleRemoveAtRstart ) == 1 )
{
new hkit = FM_NULLENT;
while( ( hkit = fm_find_ent_by_class( hkit, gMedKitClassname ) ) )
{
engfunc( EngFunc_RemoveEntity, hkit );
}
}
}
/* --| End of plugin */
decime cuando me lo robe ves mi nombre en el plugin ?
ensima que el plugin que posteaste no tiene author sino lo arreglaria :_