Mensajes: 1,836
Temas: 66
Registro en: Oct 2013
09/04/2016, 08:48 PM
(Última modificación: 04/08/2016, 11:22 PM por josue9243 .)
Bueno, lo hice cuando estaba alpedo
CABE DESTACAR QUE ESTO LO SAQUE DE ARKSHINE, CLARO QUE LAS ARMAS LES COLOQUE SUS PROPIEDADES ONE POR ONE
Sirve para:
Cita: Remplazar las imagenes que salen en el hud, SPR por decirlo asi.
Modo de uso:
Cita: - Colocar su respectivo weapon_ARMA en sprites/ , después de eso lo ponen en el stock y listo, por ejemplo:
- weapon_gauss <- lo pongo en sprites/ con sus respectivos sprites modificados y lo uso asi:
Código PHP:
set_weapon_hud ( index , CSW_KNIFE , "weapon_gauss" )
BUUUUUUUUUUGS:
Cita: Cuando colocas el hud modificado, no podes cambiar de arma, se puede ver todo pero al arma no la podes seleccionar, podes hacer lo siguiente, dejar el arma sola para un carnage en mi caso, metali si lees esto dame una solución (?)
Gracias a Santjcs & Federicomb por optimizar code.
Código PHP:
enum _ : Struc_Weapons { WeaponID , PrimaryAmmoID , PrimaryAmmoMaxAmount , SlotID , NumberInSlot , Flags } new const Weapons [ ][ Struc_Weapons ] = { { 0 , 0 , 0 , 0 , 0 , 0 }, { CSW_P228 , 9 , 52 , 1 , 3 , 0 }, { 0 , 0 , 0 , 0 , 0 , 0 }, { CSW_SCOUT , 2 , 90 , 0 , 9 , 0 }, { CSW_HEGRENADE , 12 , 1 , 3 , 1 , 24 }, { CSW_XM1014 , 5 , 32 , 0 , 12 , 0 }, { CSW_C4 , 14 , 1 , 4 , 3 , 24 }, { CSW_MAC10 , 6 , 100 , 0 , 13 , 0 }, { CSW_AUG , 4 , 90 , 0 , 14 , 0 }, { CSW_SMOKEGRENADE , 13 , 1 , 3 , 3 , 24 }, { CSW_ELITE , 10 , 120 , 1 , 5 , 0 }, { CSW_FIVESEVEN , 7 , 100 , 1 , 6 , 0 }, { CSW_UMP45 , 6 , 100 , 0 , 15 , 0 }, { CSW_SG550 , 4 , 90 , 0 , 16 , 0 }, { CSW_GALIL , 4 , 90 , 0 , 17 , 0 }, { CSW_FAMAS , 4 , 90 , 0 , 18 , 0 }, { CSW_USP , 6 , 100 , 1 , 14 , 0 }, { CSW_GLOCK18 , 10 , 120 , 1 , 2 , 0 }, { CSW_AWP , 1 , 30 , 0 , 2 , 0 }, { CSW_MP5NAVY , 10 , 120 , 0 , 7 , 0 }, { CSW_M249 , 3 , 200 , 0 , 4 , 0 }, { CSW_M3 , 5 , 32 , 0 , 5 , 0 }, { CSW_M4A1 , 4 , 90 , 0 , 6 , 0 }, { CSW_TMP , 10 , 120 , 0 , 11 , 0 }, { CSW_G3SG1 , 2 , 90 , 0 , 3 , 0 }, { CSW_FLASHBANG , 11 , 2 , 3 , 2 , 24 }, { CSW_DEAGLE , 8 , 35 , 1 , 1 , 0 }, { CSW_SG552 , 4 , 90 , 0 , 10 , 0 }, { CSW_AK47 , 2 , 90 , 0 , 1 , 0 }, { CSW_KNIFE , - 1 , - 1 , 2 , 1 , 0 }, { CSW_P90 , 7 , 100 , 0 , 8 , 0 } }; stock set_weapon_hud ( index , CSW_weapon , const hud_txt_replace [ ] ) { static iWeaponList ; if( iWeaponList || ( iWeaponList = get_user_msgid ( "WeaponList" ))) { message_begin ( MSG_ONE , iWeaponList , { 0 , 0 , 0 }, index ) { write_string ( hud_txt_replace ); // WeaponName write_byte ( Weapons [ CSW_weapon ][ PrimaryAmmoID ] ); // PrimaryAmmoID write_byte ( Weapons [ CSW_weapon ][ PrimaryAmmoMaxAmount ] ); // PrimaryAmmoMaxAmount write_byte ( - 1 ); // SecondaryAmmoID write_byte ( - 1 ); // SecondaryAmmoMaxAmount write_byte ( Weapons [ CSW_weapon ][ SlotID ] ); // SlotID (0...N) write_byte ( Weapons [ CSW_weapon ][ NumberInSlot ] ); // NumberInSlot (1...N) write_byte ( Weapons [ CSW_weapon ][ WeaponID ] ); // WeaponID write_byte ( Weapons [ CSW_weapon ][ Flags ] ); // Flags } message_end (); } }
Mensajes: 3,284
Temas: 41
Registro en: Jan 2014
Reputación:
28
Podrías hacer una const con todos los datos y evitar hacer el switch ese enorme.
Mensajes: 1,836
Temas: 66
Registro en: Oct 2013
(09/04/2016, 09:46 PM) Federicomb escribió: Podrías hacer una const con todos los datos y evitar hacer el switch ese enorme.
Lo hecho hecho esta
Mensajes: 3,284
Temas: 41
Registro en: Jan 2014
Reputación:
28
(09/04/2016, 09:49 PM) josue9243 escribió: (09/04/2016, 09:46 PM) Federicomb escribió: Podrías hacer una const con todos los datos y evitar hacer el switch ese enorme.
Lo hecho hecho esta
No digas eso, así no vas a progresar. De todas formas puedes hacer como más te guste.
Para mi la idea de la const es ahorrarte tiempo en hacer 'ciertas' cosas y evitar hacer un código taaan largo que a la larga en un tiempo no vas a entender que hiciste. ¿Se entiende lo que dije?
Mensajes: 1,836
Temas: 66
Registro en: Oct 2013
Mensajes: 224
Temas: 3
Registro en: Aug 2015
Reputación:
9
Código PHP:
#include < amxmodx > enum _ : Struc_Weapons { WeaponID , PrimaryAmmoID , PrimaryAmmoMaxAmount , SlotID , NumberInSlot , Flags } new const Weapons [ ][ Struc_Weapons ] = { { CSW_P228 , 9 , 52 , 1 , 3 , 0 }, { CSW_SCOUT , 2 , 90 , 0 , 9 , 0 }, { CSW_HEGRENADE , 12 , 1 , 3 , 1 , 24 }, { CSW_XM1014 , 5 , 32 , 0 , 12 , 0 }, { CSW_C4 , 14 , 1 , 4 , 3 , 24 }, { CSW_MAC10 , 6 , 100 , 0 , 13 , 0 }, { CSW_AUG , 4 , 90 , 0 , 14 , 0 }, { CSW_SMOKEGRENADE , 13 , 1 , 3 , 3 , 24 }, { CSW_ELITE , 10 , 120 , 1 , 5 , 0 }, { CSW_FIVESEVEN , 7 , 100 , 1 , 6 , 0 }, { CSW_UMP45 , 6 , 100 , 0 , 15 , 0 }, { CSW_SG550 , 4 , 90 , 0 , 16 , 0 }, { CSW_GALIL , 4 , 90 , 0 , 17 , 0 }, { CSW_FAMAS , 4 , 90 , 0 , 18 , 0 }, { CSW_USP , 6 , 100 , 1 , 14 , 0 }, { CSW_GLOCK18 , 10 , 120 , 1 , 2 , 0 }, { CSW_AWP , 1 , 30 , 0 , 2 , 0 }, { CSW_MP5NAVY , 10 , 120 , 0 , 7 , 0 }, { CSW_M249 , 3 , 200 , 0 , 4 , 0 }, { CSW_M3 , 5 , 32 , 0 , 5 , 0 }, { CSW_M4A1 , 4 , 90 , 0 , 6 , 0 }, { CSW_TMP , 10 , 120 , 0 , 11 , 0 }, { CSW_G3SG1 , 2 , 90 , 0 , 3 , 0 }, { CSW_FLASHBANG , 11 , 2 , 3 , 2 , 24 }, { CSW_DEAGLE , 8 , 35 , 1 , 1 , 0 }, { CSW_SG552 , 4 , 90 , 0 , 10 , 0 }, { CSW_AK47 , 2 , 90 , 0 , 1 , 0 }, { CSW_KNIFE , - 1 , - 1 , 2 , 1 , 0 }, { CSW_P90 , 7 , 100 , 0 , 8 , 0 } }; public plugin_init ( ) { } stock set_weapon_hud ( index , CSW_weapon , const hud_txt_replace [ ] ) { message_begin ( MSG_ONE , get_user_msgid ( "WeaponList" ), { 0 , 0 , 0 }, index ) { for( new i = 0 ; i < sizeof Weapons [ ]; i ++ ) { write_string ( hud_txt_replace ); // WeaponName write_byte ( Weapons [ i ][ PrimaryAmmoID ] ); // PrimaryAmmoID write_byte ( Weapons [ i ][ PrimaryAmmoMaxAmount ] ); // PrimaryAmmoMaxAmount write_byte ( - 1 ); // SecondaryAmmoID write_byte ( - 1 ); // SecondaryAmmoMaxAmount write_byte ( Weapons [ i ][ SlotID ] ); // SlotID (0...N) write_byte ( Weapons [ i ][ NumberInSlot ] ); // NumberInSlot (1...N) write_byte ( Weapons [ i ][ WeaponID ] ); // WeaponID write_byte ( Weapons [ i ][ Flags ] ); // Flags } } message_end (); }
Hide&Seek
Mensajes: 1,836
Temas: 66
Registro en: Oct 2013
(09/04/2016, 10:50 PM) Santjcs escribió: Código PHP:
#include < amxmodx > enum _ : Struc_Weapons { WeaponID , PrimaryAmmoID , PrimaryAmmoMaxAmount , SlotID , NumberInSlot , Flags } new const Weapons [ ][ Struc_Weapons ] = { { CSW_P228 , 9 , 52 , 1 , 3 , 0 }, { CSW_SCOUT , 2 , 90 , 0 , 9 , 0 }, { CSW_HEGRENADE , 12 , 1 , 3 , 1 , 24 }, { CSW_XM1014 , 5 , 32 , 0 , 12 , 0 }, { CSW_C4 , 14 , 1 , 4 , 3 , 24 }, { CSW_MAC10 , 6 , 100 , 0 , 13 , 0 }, { CSW_AUG , 4 , 90 , 0 , 14 , 0 }, { CSW_SMOKEGRENADE , 13 , 1 , 3 , 3 , 24 }, { CSW_ELITE , 10 , 120 , 1 , 5 , 0 }, { CSW_FIVESEVEN , 7 , 100 , 1 , 6 , 0 }, { CSW_UMP45 , 6 , 100 , 0 , 15 , 0 }, { CSW_SG550 , 4 , 90 , 0 , 16 , 0 }, { CSW_GALIL , 4 , 90 , 0 , 17 , 0 }, { CSW_FAMAS , 4 , 90 , 0 , 18 , 0 }, { CSW_USP , 6 , 100 , 1 , 14 , 0 }, { CSW_GLOCK18 , 10 , 120 , 1 , 2 , 0 }, { CSW_AWP , 1 , 30 , 0 , 2 , 0 }, { CSW_MP5NAVY , 10 , 120 , 0 , 7 , 0 }, { CSW_M249 , 3 , 200 , 0 , 4 , 0 }, { CSW_M3 , 5 , 32 , 0 , 5 , 0 }, { CSW_M4A1 , 4 , 90 , 0 , 6 , 0 }, { CSW_TMP , 10 , 120 , 0 , 11 , 0 }, { CSW_G3SG1 , 2 , 90 , 0 , 3 , 0 }, { CSW_FLASHBANG , 11 , 2 , 3 , 2 , 24 }, { CSW_DEAGLE , 8 , 35 , 1 , 1 , 0 }, { CSW_SG552 , 4 , 90 , 0 , 10 , 0 }, { CSW_AK47 , 2 , 90 , 0 , 1 , 0 }, { CSW_KNIFE , - 1 , - 1 , 2 , 1 , 0 }, { CSW_P90 , 7 , 100 , 0 , 8 , 0 } }; public plugin_init ( ) { } stock set_weapon_hud ( index , CSW_weapon , const hud_txt_replace [ ] ) { message_begin ( MSG_ONE , get_user_msgid ( "WeaponList" ), { 0 , 0 , 0 }, index ) { for( new i = 0 ; i < sizeof Weapons [ ]; i ++ ) { write_string ( hud_txt_replace ); // WeaponName write_byte ( Weapons [ i ][ PrimaryAmmoID ] ); // PrimaryAmmoID write_byte ( Weapons [ i ][ PrimaryAmmoMaxAmount ] ); // PrimaryAmmoMaxAmount write_byte ( - 1 ); // SecondaryAmmoID write_byte ( - 1 ); // SecondaryAmmoMaxAmount write_byte ( Weapons [ i ][ SlotID ] ); // SlotID (0...N) write_byte ( Weapons [ i ][ NumberInSlot ] ); // NumberInSlot (1...N) write_byte ( Weapons [ i ][ WeaponID ] ); // WeaponID write_byte ( Weapons [ i ][ Flags ] ); // Flags } } message_end (); }
Lo unico que haces es setear todos los hud a su normalidad, eso ni funciona.
Mensajes: 3,284
Temas: 41
Registro en: Jan 2014
Reputación:
28
10/04/2016, 01:17 AM
(Última modificación: 10/04/2016, 01:18 AM por Federicomb .)
Esta era la idea:
Código PHP:
stock set_weapon_hud ( index , CSW_weapon , const hud_txt_replace [ ] ) { static iWeaponList ; if( iWeaponList || ( iWeaponList = get_user_msgid ( "WeaponList" ))) { message_begin ( MSG_ONE , iWeaponList , { 0 , 0 , 0 }, index ) { write_string ( hud_txt_replace ); // WeaponName write_byte ( Weapons [ CSW_weapon ][ PrimaryAmmoID ] ); // PrimaryAmmoID write_byte ( Weapons [ CSW_weapon ][ PrimaryAmmoMaxAmount ] ); // PrimaryAmmoMaxAmount write_byte ( - 1 ); // SecondaryAmmoID write_byte ( - 1 ); // SecondaryAmmoMaxAmount write_byte ( Weapons [ CSW_weapon ][ SlotID ] ); // SlotID (0...N) write_byte ( Weapons [ CSW_weapon ][ NumberInSlot ] ); // NumberInSlot (1...N) write_byte ( Weapons [ CSW_weapon ][ WeaponID ] ); // WeaponID write_byte ( Weapons [ CSW_weapon ][ Flags ] ); // Flags } message_end (); } }
Y para no hacer una llamada al módulo cada vez que se usa el stock para obtener el "msgid" lo hardcodeo.
PD: Cada item de la const tiene que responder a cada arma (CSW_).
Mensajes: 4,247
Temas: 94
Registro en: Mar 2014
Reputación:
58
Lo que hizo federico iba yo a decir xD pero como no estaba en la pc no lo comenté...
PD: Buen aporte, me servirá mucho!
Estudia siempre; el tiempo es oro, lo material se puede recuperar pero el tiempo no se puede recuperar.
(02/10/2016, 05:05 PM) meTaLiCroSS escribió: Siempre me gusta ayudar cuando alguien esta interesado realmente en ver que esta programando. (08/08/2019, 05:32 PM) meTaLiCroSS escribió: grax x el dato cr4ck
Mis aportes
PLUGINS MAPAS
Menú LANG
[SF] Sistema de Frags
Say System (Admin Prefix)
Mensajes: 3,466
Temas: 18
Registro en: Oct 2013
Reputación:
54
Solo a 1 persona en este mundo se le ocurre hacer un switch con cerca de 27 cases haciendo exactamente lo mismo con distintos valores... y no se le ocurre usar arrays. No se si reportar esto o irme de aqui, no se para que me preguntas cosas si ni bola le das. -1
Mensajes: 4,383
Temas: 132
Registro en: Apr 2015
Reputación:
23
Buen aporte :V me vale verga pero buen aporte
quien sabe y luego necesite usarlo
* Ing. Informático * Mapper * Venezolano
Mensajes: 1,836
Temas: 66
Registro en: Oct 2013
(10/04/2016, 06:01 AM) meTaLiCroSS escribió: Solo a 1 persona en este mundo se le ocurre hacer un switch con cerca de 27 cases haciendo exactamente lo mismo con distintos valores... y no se le ocurre usar arrays. No se si reportar esto o irme de aqui, no se para que me preguntas cosas si ni bola le das. -1
Me parecio mas sencillo hacerlo a mi manera, hago algo mal bueno por lo menos aporto cosas que por ahi ni se conocen.
Y si se me ocurre hacer 27 switchs es mi problema, soy especial (?)
Mensajes: 196
Temas: 29
Registro en: Apr 2016
Reputación:
0
Una imagen para ver el resultado por favor ?