Mensajes: 178
Temas: 68
Registro en: May 2017
Reputación:
0
05/04/2020, 02:43 AM
(Última modificación: 05/04/2020, 08:49 PM por RiSpEK-.S. Edited 1 time in total.)
errores
Código: Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team
C:\Users\diego\Desktop\hats2021.sma(21) : warning 228: length of initialler exceeds size of the enum field
C:\Users\diego\Desktop\hats2021.sma(21) : error 018: initialization data exceeds declared size
C:\Users\diego\Desktop\hats2021.sma(90) : error 047: array sizes do not match, or destination array is too small
C:\Users\diego\Desktop\hats2021.sma(117) : error 047: array sizes do not match, or destination array is too small
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <amxmisc>
#define PLUGIN "Plugin" #define VERSION "1.0" #define AUTHOR "author'"
new g_hat[33][20] // 2 variables, una para guardar el sombrero y otra para la entidad.
enum _:HatsData { Model[33], Name[33] }; new const HATS[] [HatsData] = { { "models/anjustcore/anonimus.mdl", "/rAnonymus" }, { "models/anjustcore/calabaza.mdl", "/RCalabaza" }, { "models/anjustcore/frankenstein.mdl", "Frankenstein" }, { "models/anjustcore/homero.mdl", "homero" }, { "models/anjustcore/jason.mdl", "jason" }, { "models/anjustcore/mago.mdl", "mago" }, { "models/anjustcore/maicra.mdl", "minecraft" }, { "models/anjustcore/marciano.mdl", "marciano" }, { "models/anjustcore/momia.mdl", "momia" }, { "models/anjustcore/naruto.mdl", "naruto" }, { "models/anjustcore/ogro.mdl", "ogro" }, { "models/anjustcore/panky.mdl", "panky" }, { "models/anjustcore/scorpion.mdl", "scorpion" }, { "models/anjustcore/subzero.mdl", "sub-zero" }, { "models/anjustcore/sonic.mdl", "sonic" }, { "models/anjustcore/soytupadre.mdl", "Darth Vader" }, { "models/anjustcore/scream.mdl", "Scream" }, { "models/anjustcore/vikingo.mdl", "Vikingo" }, { "models/anjustcore/volao.mdl", "Volado" }, { "models/anjustcore/yoda.mdl", "Yoda" } } public plugin_precache() { for (new i = 0; i < sizeof(HATS); i++) { precache_model(HATS[i][Model]) } }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /hats", "clcmd_hats") } public clcmd_hats(id) { if(!is_user_admin(id)) return;
new menu = menu_create("Menu de Hats", "menu_hats"); new szBuffer[40]; menu_additem(menu, "\yRemover hat^n")
for (new i = 0; i < sizeof(HATS); i++) { formatex(szBuffer, charsmax(szBuffer), "%s", HATS[i][Name])
menu_additem(menu, szBuffer); }
menu_display(id, menu); }
public menu_hats(id, menu, item) { if (!(0 <= item <= sizeof(HATS))) { menu_destroy(menu); return PLUGIN_HANDLED; } if (!item) { if (!g_hat[id][0]) { client_print(id, print_chat, "No tienes ningun HAT puesto.") return PLUGIN_HANDLED; } if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]) g_hat[id] = { 20, 0 }; client_print(id, print_chat, "Has Removido tu Hat Correctamente.") } else { g_hat[id][0] = item; if (!is_valid_ent(g_hat[id][1])) { g_hat[id][1] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); set_pev(g_hat[id][1], pev_movetype, MOVETYPE_FOLLOW); set_pev(g_hat[id][1], pev_aiment, id); } engfunc(EngFunc_SetModel, g_hat[id][1], HATS[item-1][Model]); client_print(id, print_chat, "Te has puesto el sombrero : %s", HATS[item][Name]) } menu_destroy(menu); return PLUGIN_HANDLED; }
public client_disconnect(id) { if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]);
g_hat[id] = { 20, 0 }; }
Zombie Plague Demolition 1.2.9
fix del sma 10%
Zombie Escape Niveles 1.0
en desarrollo
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
Agregale más celdas a Model que está en el enum...
Mensajes: 811
Temas: 99
Registro en: Jun 2019
Reputación:
8
Prueba a ver.
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <amxmisc>
#define PLUGIN "Plugin" #define VERSION "1.0" #define AUTHOR "author'"
new g_hat[33][20] // 2 variables, una para guardar el sombrero y otra para la entidad.
enum _:HatsData { Model[33], Name[33] }; new const HATS[][] [HatsData] = { { "models/anjustcore/anonimus.mdl", "/rAnonymus" }, { "models/anjustcore/calabaza.mdl", "/RCalabaza" }, { "models/anjustcore/frankenstein.mdl", "Frankenstein" }, { "models/anjustcore/homero.mdl", "homero" }, { "models/anjustcore/jason.mdl", "jason" }, { "models/anjustcore/mago.mdl", "mago" }, { "models/anjustcore/maicra.mdl", "minecraft" }, { "models/anjustcore/marciano.mdl", "marciano" }, { "models/anjustcore/momia.mdl", "momia" }, { "models/anjustcore/naruto.mdl", "naruto" }, { "models/anjustcore/ogro.mdl", "ogro" }, { "models/anjustcore/panky.mdl", "panky" }, { "models/anjustcore/scorpion.mdl", "scorpion" }, { "models/anjustcore/subzero.mdl", "sub-zero" }, { "models/anjustcore/sonic.mdl", "sonic" }, { "models/anjustcore/soytupadre.mdl", "Darth Vader" }, { "models/anjustcore/scream.mdl", "Scream" }, { "models/anjustcore/vikingo.mdl", "Vikingo" }, { "models/anjustcore/volao.mdl", "Volado" }, { "models/anjustcore/yoda.mdl", "Yoda" } } public plugin_precache() { for (new i = 0; i < sizeof(HATS); i++) { precache_model(HATS[i][Model]) } }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /hats", "clcmd_hats") } public clcmd_hats(id) { if(!is_user_admin(id)) return;
new menu = menu_create("Menu de Hats", "menu_hats"); new szBuffer[40]; menu_additem(menu, "\yRemover hat^n")
for (new i = 0; i < sizeof(HATS); i++) { formatex(szBuffer, charsmax(szBuffer), "%s", HATS[i][i][Name])
menu_additem(menu, szBuffer); }
menu_display(id, menu); }
public menu_hats(id, menu, item) { if (!(0 <= item <= sizeof(HATS))) { menu_destroy(menu); return PLUGIN_HANDLED; } if (!item) { if (!g_hat[id][0]) { client_print(id, print_chat, "No tienes ningun HAT puesto.") return PLUGIN_HANDLED; } if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]) g_hat[id] = "20"; client_print(id, print_chat, "Has Removido tu Hat Correctamente.") } else { g_hat[id][0] = item; if (!is_valid_ent(g_hat[id][1])) { g_hat[id][1] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); set_pev(g_hat[id][1], pev_movetype, MOVETYPE_FOLLOW); set_pev(g_hat[id][1], pev_aiment, id); } engfunc(EngFunc_SetModel, g_hat[id][1], HATS[item-1][Model]); client_print(id, print_chat, "Te has puesto el sombrero : %s", HATS[item][item][Name]) } menu_destroy(menu); return PLUGIN_HANDLED; }
public client_disconnect(id) { if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]);
g_hat[id] = "20"; }
I dream of someday being able to have your near.
Mensajes: 215
Temas: 4
Registro en: Jan 2016
Reputación:
5
05/04/2020, 04:15 PM
(Última modificación: 05/04/2020, 04:32 PM por samueldmq. Edited 2 times in total.)
Prueba y me cuentas :3
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <amxmisc>
#define PLUGIN "Plugin" #define VERSION "1.0" //#define AUTHOR "¿Por que quitaste el autor?, ¿acaso igual piensas delinquirlo luego de solucionar?" <3 xd #define AUTHOR "Mario AR" //////////////////////////////////////////////////////////////////////////////////////// //new g_hat[33][20] // 2 variables, una para guardar el sombrero y otra para la entidad. new g_hat[33][2] // Solo necesita 2 variables de la 2da dimensión ////////////////////////////////////////////////////////////////////////////////////////
enum _:HatsData { //////////////////////////////////////////////////////////////////////////////////////// //Model[33], espacio insuficiente del array (length of initialler exceeds size of the enum field) //Name[33] Esto no da ningún error, pero es mas espacio del que necesita xD Model[36], Name[14] //////////////////////////////////////////////////////////////////////////////////////// }; new const HATS[] [HatsData] = { { "models/anjustcore/anonimus.mdl", "/rAnonymus" }, { "models/anjustcore/calabaza.mdl", "/RCalabaza" }, { "models/anjustcore/frankenstein.mdl", "Frankenstein" }, { "models/anjustcore/homero.mdl", "homero" }, { "models/anjustcore/jason.mdl", "jason" }, { "models/anjustcore/mago.mdl", "mago" }, { "models/anjustcore/maicra.mdl", "minecraft" }, { "models/anjustcore/marciano.mdl", "marciano" }, { "models/anjustcore/momia.mdl", "momia" }, { "models/anjustcore/naruto.mdl", "naruto" }, { "models/anjustcore/ogro.mdl", "ogro" }, { "models/anjustcore/panky.mdl", "panky" }, { "models/anjustcore/scorpion.mdl", "scorpion" }, { "models/anjustcore/subzero.mdl", "sub-zero" }, { "models/anjustcore/sonic.mdl", "sonic" }, { "models/anjustcore/soytupadre.mdl", "Darth Vader" }, { "models/anjustcore/scream.mdl", "Scream" }, { "models/anjustcore/vikingo.mdl", "Vikingo" }, { "models/anjustcore/volao.mdl", "Volado" }, { "models/anjustcore/yoda.mdl", "Yoda" } } public plugin_precache() { for (new i = 0; i < sizeof(HATS); i++) { precache_model(HATS[i][Model]) } }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /hats", "clcmd_hats") } public clcmd_hats(id) { if(!is_user_admin(id)) return;
new menu = menu_create("Menu de Hats", "menu_hats"); new szBuffer[40]; menu_additem(menu, "\yRemover hat^n")
for (new i = 0; i < sizeof(HATS); i++) { formatex(szBuffer, charsmax(szBuffer), "%s", HATS[i][Name])
menu_additem(menu, szBuffer); }
menu_display(id, menu); }
public menu_hats(id, menu, item) { if (!(0 <= item <= sizeof(HATS))) { menu_destroy(menu); return PLUGIN_HANDLED; } if (!item) { if (!g_hat[id][0]) { client_print(id, print_chat, "No tienes ningun HAT puesto.") return PLUGIN_HANDLED; } if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]) //////////////////////////////////////////////////////////////////////////////////////// //g_hat[id] = { 20, 0 }; // Así debería funcionar, pero no funcionaría bien con el if que está arriba //array sizes do not match, or destination array is too small g_hat[id] = { 0, 0} ; // Segun yo así debería funcionar "bien" :,v //////////////////////////////////////////////////////////////////////////////////////// client_print(id, print_chat, "Has Removido tu Hat Correctamente.") } else { g_hat[id][0] = item; if (!is_valid_ent(g_hat[id][1])) { g_hat[id][1] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); set_pev(g_hat[id][1], pev_movetype, MOVETYPE_FOLLOW); set_pev(g_hat[id][1], pev_aiment, id); } engfunc(EngFunc_SetModel, g_hat[id][1], HATS[item-1][Model]); client_print(id, print_chat, "Te has puesto el sombrero : %s", HATS[item][Name]) } menu_destroy(menu); return PLUGIN_HANDLED; }
public client_disconnect(id) { if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]); //////////////////////////////////////////////////////////////////////////////////////// //g_hat[id] = { 20, 0 }; // Me pica el ano g_hat[id] = { 0, 0 } // Segun yo así debería funcionar "bien" :,v //////////////////////////////////////////////////////////////////////////////////////// }
Estoy cansado de este sufrimiento llamado vivir en Venezuela
Mensajes: 3,466
Temas: 18
Registro en: Oct 2013
Reputación:
54
Cita:C:\Users\diego\Desktop\hats2021.sma(21) : warning 228: length of initialler exceeds size of the enum field
C:\Users\diego\Desktop\hats2021.sma(21) : error 018: initialization data exceeds declared size
Cita:enum _:HatsData
{
Model[33],
Name[33]
};
Código: { "models/anjustcore/frankenstein.mdl", "Frankenstein" },
-->
Cita:enum _:HatsData
{
Model[64], // de preferencia una potencia de 2
Name[33]
};
Mensajes: 178
Temas: 68
Registro en: May 2017
Reputación:
0
(05/04/2020, 04:15 PM)samueldmq escribió: Prueba y me cuentas :3
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <amxmisc>
#define PLUGIN "Plugin" #define VERSION "1.0" //#define AUTHOR "¿Por que quitaste el autor?, ¿acaso igual piensas delinquirlo luego de solucionar?" <3 xd #define AUTHOR "Mario AR" //////////////////////////////////////////////////////////////////////////////////////// //new g_hat[33][20] // 2 variables, una para guardar el sombrero y otra para la entidad. new g_hat[33][2] // Solo necesita 2 variables de la 2da dimensión ////////////////////////////////////////////////////////////////////////////////////////
enum _:HatsData { //////////////////////////////////////////////////////////////////////////////////////// //Model[33], espacio insuficiente del array (length of initialler exceeds size of the enum field) //Name[33] Esto no da ningún error, pero es mas espacio del que necesita xD Model[36], Name[14] //////////////////////////////////////////////////////////////////////////////////////// }; new const HATS[] [HatsData] = { { "models/anjustcore/anonimus.mdl", "/rAnonymus" }, { "models/anjustcore/calabaza.mdl", "/RCalabaza" }, { "models/anjustcore/frankenstein.mdl", "Frankenstein" }, { "models/anjustcore/homero.mdl", "homero" }, { "models/anjustcore/jason.mdl", "jason" }, { "models/anjustcore/mago.mdl", "mago" }, { "models/anjustcore/maicra.mdl", "minecraft" }, { "models/anjustcore/marciano.mdl", "marciano" }, { "models/anjustcore/momia.mdl", "momia" }, { "models/anjustcore/naruto.mdl", "naruto" }, { "models/anjustcore/ogro.mdl", "ogro" }, { "models/anjustcore/panky.mdl", "panky" }, { "models/anjustcore/scorpion.mdl", "scorpion" }, { "models/anjustcore/subzero.mdl", "sub-zero" }, { "models/anjustcore/sonic.mdl", "sonic" }, { "models/anjustcore/soytupadre.mdl", "Darth Vader" }, { "models/anjustcore/scream.mdl", "Scream" }, { "models/anjustcore/vikingo.mdl", "Vikingo" }, { "models/anjustcore/volao.mdl", "Volado" }, { "models/anjustcore/yoda.mdl", "Yoda" } } public plugin_precache() { for (new i = 0; i < sizeof(HATS); i++) { precache_model(HATS[i][Model]) } }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /hats", "clcmd_hats") } public clcmd_hats(id) { if(!is_user_admin(id)) return;
new menu = menu_create("Menu de Hats", "menu_hats"); new szBuffer[40]; menu_additem(menu, "\yRemover hat^n")
for (new i = 0; i < sizeof(HATS); i++) { formatex(szBuffer, charsmax(szBuffer), "%s", HATS[i][Name])
menu_additem(menu, szBuffer); }
menu_display(id, menu); }
public menu_hats(id, menu, item) { if (!(0 <= item <= sizeof(HATS))) { menu_destroy(menu); return PLUGIN_HANDLED; } if (!item) { if (!g_hat[id][0]) { client_print(id, print_chat, "No tienes ningun HAT puesto.") return PLUGIN_HANDLED; } if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]) //////////////////////////////////////////////////////////////////////////////////////// //g_hat[id] = { 20, 0 }; // Así debería funcionar, pero no funcionaría bien con el if que está arriba //array sizes do not match, or destination array is too small g_hat[id] = { 0, 0} ; // Segun yo así debería funcionar "bien" :,v //////////////////////////////////////////////////////////////////////////////////////// client_print(id, print_chat, "Has Removido tu Hat Correctamente.") } else { g_hat[id][0] = item; if (!is_valid_ent(g_hat[id][1])) { g_hat[id][1] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); set_pev(g_hat[id][1], pev_movetype, MOVETYPE_FOLLOW); set_pev(g_hat[id][1], pev_aiment, id); } engfunc(EngFunc_SetModel, g_hat[id][1], HATS[item-1][Model]); client_print(id, print_chat, "Te has puesto el sombrero : %s", HATS[item][Name]) } menu_destroy(menu); return PLUGIN_HANDLED; }
public client_disconnect(id) { if (pev_valid(g_hat[id][1])) engfunc(EngFunc_RemoveEntity, g_hat[id][1]); //////////////////////////////////////////////////////////////////////////////////////// //g_hat[id] = { 20, 0 }; // Me pica el ano g_hat[id] = { 0, 0 } // Segun yo así debería funcionar "bien" :,v //////////////////////////////////////////////////////////////////////////////////////// }
me funciono lo que dijo metalicross
Zombie Plague Demolition 1.2.9
fix del sma 10%
Zombie Escape Niveles 1.0
en desarrollo
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
(05/04/2020, 08:21 PM)RiSpEK-.S escribió: me funciono lo que dijo metalicross
|