enum bru { a1 , a2 } new arr[bru]; arr[a1] = 5; arr[a2] = 8; printf("%d - %d - %d", arr[a1], arr[a2], bru); // vai resetar a enum for(new i; i != _: bru; i++) arr[bru:i] = 0; printf("%d - %d - %d", arr[a1], arr[a2], bru);
enum E_ENUM { id, Float:PosX[10] // 10 coordenadas X }; new array[5][E_ENUM];
for(new i; i != 5; i++) { array[i][id] = 0; for(new u; u != 10; u++) { array[i][PosX][u] = 0.0; } }
enum bru {
a1 ,
a2,
Float:PosX[10]
}
new arr[bru];
main()
{
arr[a1] = 5;
arr[a2] = 8;
arr[PosX][0] = 9;
arr[PosX][1] = 10;
arr[PosX][2] = 11;
arr[PosX][3] = 12;
arr[PosX][4] = 13;
arr[PosX][5] = 14;
arr[PosX][6] = 15;
arr[PosX][7] = 16;
arr[PosX][8] = 17;
arr[PosX][9] = 18;
printf("%d - %d - %d", arr[a1], arr[a2], bru);
printf("%f - %f - %f - %f - %f", arr[PosX][0], arr[PosX][1], arr[PosX][2], arr[PosX][3], arr[PosX][4]);
printf("%f - %f - %f - %f - %f", arr[PosX][5], arr[PosX][6], arr[PosX][7], arr[PosX][8], arr[PosX][9]);
print("\nResetando:\n");
// vai resetar a enum
for(new i; i != _: bru; i++) arr[bru:i] = 0;
printf("%d - %d - %d", arr[a1], arr[a2], bru);
printf("%f - %f - %f - %f - %f", arr[PosX][0], arr[PosX][1], arr[PosX][2], arr[PosX][3], arr[PosX][4]);
printf("%f - %f - %f - %f - %f", arr[PosX][5], arr[PosX][6], arr[PosX][7], arr[PosX][8], arr[PosX][9]);
Faz da mesma maneira do tуpico do Bruno.
PHP код:
|
#include <a_samp>
enum bru {
a1 ,
a2,
Float:PosX[10]
}
new arr[5][bru];
main()
{
arr[a1] = 5;
arr[a2] = 8;
arr[1][PosX][0] = 9;
arr[1][PosX][1] = 10;
arr[1][PosX][2] = 11;
arr[1][PosX][3] = 12;
arr[1][PosX][4] = 13;
arr[1][PosX][5] = 14;
arr[1][PosX][6] = 15;
arr[1][PosX][7] = 16;
arr[1][PosX][8] = 17;
arr[1][PosX][9] = 18;
printf("%d - %d - %d", arr[a1], arr[a2], bru);
printf("%f - %f - %f - %f - %f", arr[1][PosX][0], arr[1][PosX][1], arr[1][PosX][2], arr[1][PosX][3], arr[1][PosX][4]);
printf("%f - %f - %f - %f - %f", arr[1][PosX][5], arr[1][PosX][6], arr[1][PosX][7], arr[1][PosX][8], arr[1][PosX][9]);
print("\nResetando:\n");
// vai resetar a enum
for(new i; i != _: bru; i++) arr[bru:i] = 0;
printf("%d - %d - %d", arr[a1], arr[a2], bru);
printf("%f - %f - %f - %f - %f", arr[1][PosX][0], arr[1][PosX][1], arr[1][PosX][2], arr[1][PosX][3], arr[1][PosX][4]);
printf("%f - %f - %f - %f - %f", arr[1][PosX][5], arr[1][PosX][6], arr[1][PosX][7], arr[1][PosX][8], arr[1][PosX][9]);
}
test.pwn(16) : error 033: array must be indexed (variable "arr") test.pwn(17) : error 033: array must be indexed (variable "arr") test.pwn(36) : error 033: array must be indexed (variable "arr")
#include <a_samp>
enum bru {
a1 ,
a2,
Float:PosX[10]
}
new arr[5][bru];
main()
{
arr[1][PosX][0] = 9;
arr[1][PosX][1] = 10;
arr[1][PosX][2] = 11;
arr[1][PosX][3] = 12;
arr[1][PosX][4] = 13;
arr[1][PosX][5] = 14;
arr[1][PosX][6] = 15;
arr[1][PosX][7] = 16;
arr[1][PosX][8] = 17;
arr[1][PosX][9] = 18;
printf("%d - %d - %d", arr[a1], arr[a2], bru);
printf("%f - %f - %f - %f - %f", arr[1][PosX][0], arr[1][PosX][1], arr[1][PosX][2], arr[1][PosX][3], arr[1][PosX][4]);
printf("%f - %f - %f - %f - %f", arr[1][PosX][5], arr[1][PosX][6], arr[1][PosX][7], arr[1][PosX][8], arr[1][PosX][9]);
print("\nResetando:\n");
// vai resetar a enum
for(new u; u != 5; u++) for(new i; i != _: bru; i++) arr[u][bru:i] = 0;
printf("%d - %d - %d", arr[a1], arr[a2], bru);
printf("%f - %f - %f - %f - %f", arr[1][PosX][0], arr[1][PosX][1], arr[1][PosX][2], arr[1][PosX][3], arr[1][PosX][4]);
printf("%f - %f - %f - %f - %f", arr[1][PosX][5], arr[1][PosX][6], arr[1][PosX][7], arr[1][PosX][8], arr[1][PosX][9]);
}
new reset[bru];
arr[index] = reset;