21/11/2020, 08:18 PM
(Última modificación: 21/11/2020, 08:20 PM por [N]drs. Edited 2 times in total.)
Código PHP:
#include <amxmodx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"
enum _:eData
{
szAny[15],
szAnyTwo[256],
szAnyThree[64],
iAnyN
}
new Array:g_aArray
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say nose", "ver")
g_aArray = ArrayCreate( eData )
}
public push(){
new Data[eData]
copy(Data[szAny], charsmax(Data), "ROJO")
copy(Data[szAnyTwo], charsmax(Data), "NOSEDOS")
copy(Data[szAnyThree], charsmax(Data), "NOSETRES")
Data[iAnyN] = 0
//aqui hay mas valores, solo es para el ejemplo
ArrayPushArray(g_aArray, Data)
}
public ver(id){
new Data[eData]
new n_one, n_two, n_three, errors
for(new i; i < ArraySize(g_aArray); i++)
{
ArrayGetArray(g_aArray, i, Data)
if(Data[szAny] == "ROJO"){
n_one++
}else if(Data[szAny] == "AZUL"){
n_two++
}else if(Data[szAny] == "VERDE"){
n_three++
}else{
errors++
}
}
client_print(id, print_chat, "ROJO: %d, AZUL: %d, VERDE: %d, ERRORES: %d", n_one, n_two, n_three, errors)
return PLUGIN_HANDLED;
}
al momento de ver si "Data[szAny]" es igual a algunas de mis opciones, me tira el error:
Código PHP:
error 033: array must be indexed (variable "-unknown-")
Cómo puedo solucionarlo?
Aportes
Bot Discord: CS Server Info Bot Discord 2023Plugins: Admin Expire (With support for MySql) || Simple Publicidad (Con soporte para MySql) v2.0 || Info de Ping en Color || Country Manager
Scripting: [API] Ndrs Player Model || [API] Tienda Avanzada v1.6
Includes: [API] Discord WebHook v2.5 || [INC] CZTutor v1.6 || [INC] Steam Avatar
Tutoriales/Guías: Agregar administradores desde plugin || [Reapi] Reemplazar Modelos de Armas || [TUT] Como instalar/actualizar a amxmodx 1.9.0
No doy ayuda gratis por privado, consulta en los foros.
Si vas a pagar por un plugin, te dejo aquí mi discord: [N]drs#5342