Mensajes: 6
Temas: 1
Registro en: Dec 2020
Reputación:
0
Algun plugin sobre un menu de cuchillos y colocarle el model que me apetezca
1) Cualquier jugador pueda utilizarlo mediante un comando en el chat ("y" escribir /knife y le salga el menu con los diferentes models)
2) Puedan cambiarse en cualquier momento de la partida ya sea mientras este vivo o muerto sin necesidad que pase una ronda
3) Si se me ocurre colocarle otro tipo de model, yo pueda hacerlo y que los otros jugadores puedan visualizarlo (ejemplo tenga un cuchillo del CS:GO y me da por cambiarlo por un model de katana)
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
26/12/2020, 09:32 PM
(Última modificación: 27/12/2020, 12:26 AM por [N]drs . Edited 4 times in total.
Razón: Update
)
Sé que está simple, pero igual no quiten ni cambien el autor ._.
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes" #define VERSION "1.5" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }
Mensajes: 144
Temas: 4
Registro en: Mar 2018
Reputación:
8
(26/12/2020, 09:32 PM) [N]drs escribió: Sé que está simple, pero igual no quiten ni cambien el autor ._.
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes" #define VERSION "1.0" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ], USING } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" , true }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" , false }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" , false }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" , false }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" , false } } new g_iKnife [ 33 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! KNIFES [ i ][ USING ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } KNIFES [ g_iKnife [ id ]][ USING ] = false KNIFES [ item ][ USING ] = true g_iKnife [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iKnife [ id ]][ V_MDL ]) }
Lo probaste con otros jugadores? A simple vista creo que si algún jugador selecciona X cuchillo a los demás les aparecerá en uso.
Aparte de que tenía entendido que a las constantes no se les puede cambiar valores como a los array
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
(26/12/2020, 11:22 PM) GabsHp escribió: Lo probaste con otros jugadores? A simple vista creo que si algún jugador selecciona X cuchillo a los demás les aparecerá en uso.
Aparte de que tenía entendido que a las constantes no se les puede cambiar valores como a los array
Cita: entity_set_string(id , EV_SZ_viewmodel, KNIFES[g_iKnife[id ]][V_MDL]) ;-;
concuerdo con eso de la constante no se le puede cambiar el valor, pero a mi me esta funcionando bien
algo anda mal
Mensajes: 144
Temas: 4
Registro en: Mar 2018
Reputación:
8
(26/12/2020, 11:52 PM) [N]drs escribió: concuerdo con eso de la constante no se le puede cambiar el valor, pero a mi me esta funcionando bien
algo anda mal
Me refería al menú, estás obteniendo si el cuchillo está en uso desde una constante. Que creo que no se puede cambiar el contenido de la constante, y en caso de cambiar sería global, y no individual a cada jugador
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
27/12/2020, 12:03 AM
(Última modificación: 27/12/2020, 12:25 AM por [N]drs . Edited 2 times in total.)
(26/12/2020, 11:56 PM) GabsHp escribió: Me refería al menú, estás obteniendo si el cuchillo está en uso desde una constante. Que creo que no se puede cambiar el contenido de la constante, y en caso de cambiar sería global, y no individual a cada jugador
el detalle es que si lo está cambiando, no sé si será bug, pero si lo está cambiando
a no, ya te entendi F
Ahora ya tendría que quedar listo xd
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes" #define VERSION "1.5" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }
Mensajes: 6
Temas: 1
Registro en: Dec 2020
Reputación:
0
(27/12/2020, 12:03 AM) [N]drs escribió: el detalle es que si lo está cambiando, no sé si será bug, pero si lo está cambiando
a no, ya te entendi F
Ahora ya tendría que quedar listo xd
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes" #define VERSION "1.5" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }
Perdon por no haber respondido, probe los 2 plugins y en los 2 no me funcionaron porque coloco el comando y sale la lista hasta ahi todo bien pero cuando selecciono un knife no se ven, sigo teniendo el mismo cuchillo base y cambie los models para ver si era el modelo o algo pero nada y segun el menu dice que lo estoy utilizando pero como dije no se cambia, no se que podria estar pasando de todas formas muchas gracias
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
(27/12/2020, 06:05 PM) Froen escribió: Perdon por no haber respondido, probe los 2 plugins y en los 2 no me funcionaron porque coloco el comando y sale la lista hasta ahi todo bien pero cuando selecciono un knife no se ven, sigo teniendo el mismo cuchillo base y cambie los models para ver si era el modelo o algo pero nada y segun el menu dice que lo estoy utilizando pero como dije no se cambia, no se que podria estar pasando de todas formas muchas gracias
Pasa el código que estás compilando
A mí me funciona bien
Mensajes: 6
Temas: 1
Registro en: Dec 2020
Reputación:
0
(27/12/2020, 08:48 PM) [N]drs escribió: Pasa el código que estás compilando
A mí me funciona bien
Este es el que estoy compilando
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#define PLUGIN "Menu Knifes"
#define VERSION "1.5"
#define AUTHOR "[N]drs"
enum _ : DATA
{
NAME [ 25 ],
V_MDL [ 126 ]
}
new const KNIFES [][ DATA ] = {
{ "Knife Default" , "models/v_knife.mdl" },
{ "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" },
{ "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" },
{ "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" },
{ "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" }
}
new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ]
public plugin_init ()
{
register_plugin ( PLUGIN , VERSION , AUTHOR )
RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true )
register_clcmd ( "say /knife" , "menu" )
}
public plugin_precache ()
{
for(new i ; i < sizeof ( KNIFES ); i ++)
precache_model ( KNIFES [ i ][ V_MDL ])
}
public client_putinserver ( id )
{
g_iUse [ id ][ g_iModel [ id ]] = 0
g_iModel [ id ] = 0
g_iUse [ id ][ 0 ] = 1
}
public menu ( id )
{
new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" );
for(new i ; i < sizeof ( KNIFES ); i ++)
{
if(! g_iUse [ id ][ i ])
formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ])
else
formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ])
menu_additem ( iMenu , text , _ , _ )
}
menu_display ( id , iMenu )
return PLUGIN_HANDLED
}
public handlermenu ( id , menu , item )
{
if( item == MENU_EXIT )
{
menu_destroy ( menu )
return PLUGIN_HANDLED
}
g_iUse [ id ][ g_iModel [ id ]] = 0
g_iUse [ id ][ item ] = 1
g_iModel [ id ] = item
client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ])
menu_destroy ( menu )
return PLUGIN_HANDLED
}
public HamItemDeploy ( iEntity )
{
new id = get_pdata_cbase ( iEntity , 41 , 4 )
entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ])
}
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
Tienes que cambiar esto por la ruta de tus modelos antes de compilarlo ;--;
Código PHP:
new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" } }
Mensajes: 6
Temas: 1
Registro en: Dec 2020
Reputación:
0
28/12/2020, 12:40 PM
(Última modificación: 28/12/2020, 12:52 PM por Froen . Edited 1 time in total.)
(28/12/2020, 12:37 PM) [N]drs escribió: Tienes que cambiar esto por la ruta de tus modelos antes de compilarlo ;--;
Código PHP:
new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" } }
Bueno creo que ya entendi voy a probar muchas gracias
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
28/12/2020, 12:54 PM
(Última modificación: 28/12/2020, 12:55 PM por [N]drs . Edited 1 time in total.)
(28/12/2020, 12:40 PM) Froen escribió: comoasi pq soy nuevo en esto que tengo que cambiar
Suponiendo que tienes ya los modelos, vas a la carpeta cstrike/models/
de tu servidor, y creas una carpeta con cualquier nombre, por ejemplo "my_knife" y en esa carpeta colocas todos tus modelos "v_nameknife.mdl"
Luego en el plugin cambias lo que te mostré en el anterior mensaje por esto:
Código PHP:
{ "Knife Nameknife" , "models/my_knife/v_nameknife.mdl" }
Y así con los siguientes modelos
-edit respondí tarde pero ahí te lo dejo por si las dudas
Mensajes: 6
Temas: 1
Registro en: Dec 2020
Reputación:
0
28/12/2020, 01:18 PM
(Última modificación: 28/12/2020, 01:20 PM por Froen . Edited 2 times in total.)
(28/12/2020, 12:54 PM) [N]drs escribió: Suponiendo que tienes ya los modelos, vas a la carpeta cstrike/models/
de tu servidor, y creas una carpeta con cualquier nombre, por ejemplo "my_knife" y en esa carpeta colocas todos tus modelos "v_nameknife.mdl"
Luego en el plugin cambias lo que te mostré en el anterior mensaje por esto:
Código PHP:
{ "Knife Nameknife" , "models/my_knife/v_nameknife.mdl" }
Y así con los siguientes modelos
-edit respondí tarde pero ahí te lo dejo por si las dudas
hice lo que me dijiste y se sigue viendo asi creo que estoy haciendo algo mal porque no se ve ni el menu igual al tuyo (ese es mi cuchillo base XD)
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
28/12/2020, 01:45 PM
(Última modificación: 28/12/2020, 01:48 PM por [N]drs . Edited 2 times in total.)
Descargas el zip, pegas la carpeta en donde corresponda, instalas el plugin y te debería funcionar
Lo modificas a tu gusto
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes + Models" #define VERSION "1.6" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/server_skins/knife/v_ursus_marblefade.mdl" }, { "Knife Two" , "models/server_skins/knife/v_karambit_slaughter.mdl" }, { "Knife Three" , "models/server_skins/knife/v_karambit_marblefade.mdl" }, { "Knife Four" , "models/server_skins/knife/v_karambit_lore.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }
Archivos adjuntos
Descargar AMXX / menu_knife.sma (Tamaño: 2.03 KB / Descargas: 81)
recursos.zip (Tamaño: 3.86 MB / Descargas: 17)
Mensajes: 6
Temas: 1
Registro en: Dec 2020
Reputación:
0
(28/12/2020, 01:45 PM) [N]drs escribió: Descargas el zip, pegas la carpeta en donde corresponda, instalas el plugin y te debería funcionar
Lo modificas a tu gusto
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes + Models" #define VERSION "1.6" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/server_skins/knife/v_ursus_marblefade.mdl" }, { "Knife Two" , "models/server_skins/knife/v_karambit_slaughter.mdl" }, { "Knife Three" , "models/server_skins/knife/v_karambit_marblefade.mdl" }, { "Knife Four" , "models/server_skins/knife/v_karambit_lore.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }
Este si me sirvio muchisimas gracias
Mensajes: 2
Temas: 1
Registro en: Jul 2020
Reputación:
0
(27/12/2020, 12:03 AM) [N]drs escribió: el detalle es que si lo está cambiando, no sé si será bug, pero si lo está cambiando
a no, ya te entendi F
Ahora ya tendría que quedar listo xd
Código PHP:
#include <amxmodx> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes" #define VERSION "1.5" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/tu_carpeta/v_tu_modelo1.mdl" }, { "Knife Two" , "models/tu_carpeta/v_tu_modelo2.mdl" }, { "Knife Three" , "models/tu_carpeta/v_tu_modelo3.mdl" }, { "Knife Four" , "models/tu_carpeta/v_tu_modelo4.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }
Che, y, si quisiera que este menu solo saliera para admines como seria? Perdon la molestia
Mensajes: 448
Temas: 38
Registro en: May 2020
Reputación:
19
(29/05/2021, 04:08 PM) ferrari escribió: Che, y, si quisiera que este menu solo saliera para admines como seria? Perdon la molestia
Código PHP:
#include <amxmodx> #include <amxmisc> #include <engine> #include <hamsandwich> #define PLUGIN "Menu Knifes + Models" #define VERSION "1.6" #define AUTHOR "[N]drs" enum _ : DATA { NAME [ 25 ], V_MDL [ 126 ] } new const KNIFES [][ DATA ] = { { "Knife Default" , "models/v_knife.mdl" }, { "Knife One" , "models/server_skins/knife/v_ursus_marblefade.mdl" }, { "Knife Two" , "models/server_skins/knife/v_karambit_slaughter.mdl" }, { "Knife Three" , "models/server_skins/knife/v_karambit_marblefade.mdl" }, { "Knife Four" , "models/server_skins/knife/v_karambit_lore.mdl" } } new g_iModel [ 33 ], g_iUse [ 33 ][ sizeof ( KNIFES ) + 1 ] public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) RegisterHam ( Ham_Item_Deploy , "weapon_knife" , "HamItemDeploy" , true ) register_clcmd ( "say /knife" , "menu" ) } public plugin_precache () { for(new i ; i < sizeof ( KNIFES ); i ++) precache_model ( KNIFES [ i ][ V_MDL ]) } public client_putinserver ( id ) { g_iUse [ id ][ g_iModel [ id ]] = 0 g_iModel [ id ] = 0 g_iUse [ id ][ 0 ] = 1 } public menu ( id ) { if(! is_user_admin ( id )) return PLUGIN_HANDLED new text [ 40 ], iMenu = menu_create ( "\r[\yAMXX\r] \wMenu Knifes" , "handlermenu" ); for(new i ; i < sizeof ( KNIFES ); i ++) { if(! g_iUse [ id ][ i ]) formatex ( text , charsmax ( text ), "%s \r[\ySeleccionar\r]" , KNIFES [ i ][ NAME ]) else formatex ( text , charsmax ( text ), "%s \r[Usando\r]" , KNIFES [ i ][ NAME ]) menu_additem ( iMenu , text , _ , _ ) } menu_display ( id , iMenu ) return PLUGIN_HANDLED } public handlermenu ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ) return PLUGIN_HANDLED } g_iUse [ id ][ g_iModel [ id ]] = 0 g_iUse [ id ][ item ] = 1 g_iModel [ id ] = item client_print ( id , print_chat , "[AMXX] Seleccionaste la skin %s" , KNIFES [ item ][ NAME ]) menu_destroy ( menu ) return PLUGIN_HANDLED } public HamItemDeploy ( iEntity ) { new id = get_pdata_cbase ( iEntity , 41 , 4 ) entity_set_string ( id , EV_SZ_viewmodel , KNIFES [ g_iModel [ id ]][ V_MDL ]) }