Plugin caja de regalos
#5
(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_iSpritesspritesStruct ];

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_bAlive33 ], g_bConnected33 ];

new 
g_szName33 ][ 32 ];

public 
plugin_precache( ) {
    
    
g_iSprites SPR_BOX ] = precache_model"sprites/HNS/box.spr" );
    
    
precache_modelg_szBoxModel );
    
    
precache_soundg_szDroppedBox );
    
precache_soundg_szPickupBox );
}

public 
plugin_init( ) {
    
    
register_plugin"HNS: Boxes""1.0""Chema" );
    
    
RegisterHamHam_Spawn,  "player",    "fw_PlayerSpawn"true );
    
RegisterHamHam_Killed"player",    "fw_PlayerKilled"true );
    
    
register_touchg_szClassnameBox"player""touchBox" );
    
    
g_iMsgSayText get_user_msgid"SayText" );
}

public 
client_putinserverid ) {

    
g_bConnectedid ] = bool:is_user_connectedid );
    
    
get_user_nameidg_szNameid ], charsmaxg_szName[ ] ) );
}

public 
fw_PlayerSpawnid ) {
    
    
g_bAliveid ] = bool:is_user_alive id );
}

public 
fw_PlayerKilledvictimattackershouldgibs ) {
    
    if ( !
g_bConnectedattacker ] || !g_bConnectedvictim ] || attacker == victim )
        return;
        
    
    if( 
random100 ) < 30 ) {
    
        
emit_soundvictimCHAN_AUTOg_szDroppedBox1.0ATTN_NORM0PITCH_NORM )
        
createBoxvictim );
    }
}

public 
touchingBoxid ) {
    
    new 
iOrigin]; get_user_originidiOrigin);
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_SPRITETRAIL );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_shortg_iSpritesSPR_BOX ] )
    
write_byte)
    
write_byte)
    
write_byte)
    
write_byte34 )
    
write_byte43 )
    
message_end( )
    
    
remove_taskid );
    
    
emit_soundidCHAN_AUTOg_szPickupBox1.0ATTN_NORM0PITCH_NORM );
    
    if( 
cs_get_user_teamid ) == CS_TEAM_CT ) {

        switch( 
random_num0) ) {

            case 
0give_buffakid ), print( id"Recibiste una AK-47!" );    
            case 
1give_buffm4id ), print( id"Recibiste una M4A1!" );    
        }
    }
    else
        print( 
id"No recibiste nada porque eres ZOMBIE!" );


public 
touchBoxiBoxid ) {
    
    if( !
is_valid_entiBox ) || !g_bAliveid ] )
        return 
PLUGIN_HANDLED;
    
    
remove_entityiBox );
    
    
touchingBoxid );
    
    return 
PLUGIN_HANDLED;
}

public 
createBoxid ) {
    
    new 
iEntiOrigin], FloatfOrigin];
    
    new 
FloatfMins] = { -5.0, -5.00.0 };
    new 
FloatfMaxs] = { 5.05.010.0 };
    
    
iEnt create_entity"info_target" );
    
get_user_originidiOrigin);
    
IVecFVeciOriginfOrigin );
    
    
entity_set_stringiEntEV_SZ_classnameg_szClassnameBox );
    
entity_set_intiEntEV_INT_solidSOLID_BBOX);
    
entity_set_intiEntEV_INT_movetypeMOVETYPE_FLY );
    
entity_set_sizeiEntfMinsfMaxs );
    
entity_set_modeliEntg_szBoxModel );
    
entity_set_vectoriEntEV_VEC_originfOrigin );
    
    
set_task1.0"setBoxColor"idiOrigin3"b" );
}

public 
setBoxColoriOrigin], id ) {

    
message_beginMSG_ONE_UNRELIABLESVC_TEMPENTITY_id );
    
write_byteTE_DLIGHT );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_byte10 );
    
write_byte);
    
write_byte);
    
write_byte255 );
    
write_byte10 );
    
write_byte);
    
message_end( );
}

stock print( const iIndex, const Text[ ], any:... ) { 
    
    new 
szText192 ];
    
    
vformatszTextsizeofszText ), Text);
    
    
    
replace_allszTextsizeofszText ), "!y""^1" );
    
replace_allszTextsizeofszText ), "!g""^4" );
    
replace_allszTextsizeofszText ), "!t""^3" );
    
    static 
iLen sizeofszText );
    
    
    
replace_allszTextiLen"á""á" );
    
replace_allszTextiLen"Á""Ã" );
    
replace_allszTextiLen"é""é" );
    
replace_allszTextiLen"É""É" );
    
replace_allszTextiLen"í""Ã*" );
    
replace_allszTextiLen"Í""Ã" );
    
replace_allszTextiLen"ó""ó" );
    
replace_allszTextiLen"Ó""Ó" );
    
replace_allszTextiLen"ú""ú" );
    
replace_allszTextiLen"Ú""Ú" );
    
replace_allszTextiLen"ñ""ñ" );
    
replace_allszTextiLen"Ñ""Ñ" );
    
    
    
message_beginiIndex MSG_ONE_UNRELIABLE MSG_BROADCASTg_iMsgSayText, .player iIndex );
    
write_byteiIndex iIndex 33 );
    
write_stringszText );
    
message_end(  );


Uff We Te Agradezco Por Siempre Ayudarme <3
Responder


Mensajes en este tema
Plugin caja de regalos - por JhoNNyNeuTroN - 08/11/2019, 05:35 AM
RE: Plugin caja de regalos - por Niper.-. - 08/11/2019, 11:54 AM
RE: Plugin caja de regalos - por JhoNNyNeuTroN - 08/11/2019, 05:00 PM
RE: Plugin caja de regalos - por Valentina. - 08/11/2019, 09:17 PM
RE: Plugin caja de regalos - por JhoNNyNeuTroN - 09/11/2019, 12:21 AM

Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)