09/11/2019, 12:21 AM
(08/11/2019, 09:17 PM)Chema escribió: Prueba y avisa.
Código PHP:#include < amxmodx >
#include < fun >
#include < cstrike >
#include < engine >
#include < hamsandwich >
#include < armas_cso >
/*
ESTAS NATIVES USARE
give_buffak
give_buffm4
*/
new g_iMsgSayText;
enum spritesStruct {
SPR_BOX
}
new g_iSprites[ spritesStruct ];
new const g_szDroppedBox[ ] = "HNS/how_is_your_life_going.wav";
new const g_szPickupBox[ ] = "HNS/how_is_your_life_going.wav";
new const g_szBoxModel[ ] = "models/HNS/present1.mdl";
new const g_szClassnameBox[ ] = "present1";
new const g_szPrefix[ ] = "!t[ ArcadeZM ]!y";
new bool:g_bAlive[ 33 ], g_bConnected[ 33 ];
new g_szName[ 33 ][ 32 ];
public plugin_precache( ) {
g_iSprites [ SPR_BOX ] = precache_model( "sprites/HNS/box.spr" );
precache_model( g_szBoxModel );
precache_sound( g_szDroppedBox );
precache_sound( g_szPickupBox );
}
public plugin_init( ) {
register_plugin( "HNS: Boxes", "1.0", "Chema" );
RegisterHam( Ham_Spawn, "player", "fw_PlayerSpawn", true );
RegisterHam( Ham_Killed, "player", "fw_PlayerKilled", true );
register_touch( g_szClassnameBox, "player", "touchBox" );
g_iMsgSayText = get_user_msgid( "SayText" );
}
public client_putinserver( id ) {
g_bConnected[ id ] = bool:is_user_connected( id );
get_user_name( id, g_szName[ id ], charsmax( g_szName[ ] ) );
}
public fw_PlayerSpawn( id ) {
g_bAlive[ id ] = bool:is_user_alive ( id );
}
public fw_PlayerKilled( victim, attacker, shouldgibs ) {
if ( !g_bConnected[ attacker ] || !g_bConnected[ victim ] || attacker == victim )
return;
if( random( 100 ) < 30 ) {
emit_sound( victim, CHAN_AUTO, g_szDroppedBox, 1.0, ATTN_NORM, 0, PITCH_NORM )
createBox( victim );
}
}
public touchingBox( id ) {
new iOrigin[ 3 ]; get_user_origin( id, iOrigin, 0 );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SPRITETRAIL );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] );
write_short( g_iSprites[ SPR_BOX ] )
write_byte( 5 )
write_byte( 1 )
write_byte( 3 )
write_byte( 34 )
write_byte( 43 )
message_end( )
remove_task( id );
emit_sound( id, CHAN_AUTO, g_szPickupBox, 1.0, ATTN_NORM, 0, PITCH_NORM );
if( cs_get_user_team( id ) == CS_TEAM_CT ) {
switch( random_num( 0, 1 ) ) {
case 0: give_buffak( id ), print( id, "Recibiste una AK-47!" );
case 1: give_buffm4( id ), print( id, "Recibiste una M4A1!" );
}
}
else
print( id, "No recibiste nada porque eres ZOMBIE!" );
}
public touchBox( iBox, id ) {
if( !is_valid_ent( iBox ) || !g_bAlive[ id ] )
return PLUGIN_HANDLED;
remove_entity( iBox );
touchingBox( id );
return PLUGIN_HANDLED;
}
public createBox( id ) {
new iEnt, iOrigin[ 3 ], Float: fOrigin[ 3 ];
new Float: fMins[ 3 ] = { -5.0, -5.0, 0.0 };
new Float: fMaxs[ 3 ] = { 5.0, 5.0, 10.0 };
iEnt = create_entity( "info_target" );
get_user_origin( id, iOrigin, 0 );
IVecFVec( iOrigin, fOrigin );
entity_set_string( iEnt, EV_SZ_classname, g_szClassnameBox );
entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX);
entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_FLY );
entity_set_size( iEnt, fMins, fMaxs );
entity_set_model( iEnt, g_szBoxModel );
entity_set_vector( iEnt, EV_VEC_origin, fOrigin );
set_task( 1.0, "setBoxColor", id, iOrigin, 3, "b" );
}
public setBoxColor( iOrigin[ 3 ], id ) {
message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id );
write_byte( TE_DLIGHT );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] );
write_byte( 10 );
write_byte( 0 );
write_byte( 0 );
write_byte( 255 );
write_byte( 10 );
write_byte( 0 );
message_end( );
}
stock print( const iIndex, const Text[ ], any:... ) {
new szText[ 192 ];
vformat( szText, sizeof( szText ), Text, 3 );
replace_all( szText, sizeof( szText ), "!y", "^1" );
replace_all( szText, sizeof( szText ), "!g", "^4" );
replace_all( szText, sizeof( szText ), "!t", "^3" );
static iLen = sizeof( szText );
replace_all( szText, iLen, "á", "á" );
replace_all( szText, iLen, "Á", "Ã" );
replace_all( szText, iLen, "é", "é" );
replace_all( szText, iLen, "É", "É" );
replace_all( szText, iLen, "í", "Ã*" );
replace_all( szText, iLen, "Í", "Ã" );
replace_all( szText, iLen, "ó", "ó" );
replace_all( szText, iLen, "Ó", "Ó" );
replace_all( szText, iLen, "ú", "ú" );
replace_all( szText, iLen, "Ú", "Ú" );
replace_all( szText, iLen, "ñ", "ñ" );
replace_all( szText, iLen, "Ñ", "Ñ" );
message_begin( iIndex ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, g_iMsgSayText, .player = iIndex );
write_byte( iIndex ? iIndex : 33 );
write_string( szText );
message_end( );
}
Uff We Te Agradezco Por Siempre Ayudarme <3