PDA

View Full Version : error 032


Heress
23/06/2018, 11:06 AM
I tried to create login/register system and i got this errors:

C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(104): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(105): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(106): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(107): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(108 ) : error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(109): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(110): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(111): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(112): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(113): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(114): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(115): error 032: array index out of bounds (variable "PlayerInfo")
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(116): error 032: array index out of bounds (variable "PlayerInfo")

104 - 116 lines

104 dini_IntSet(Accounts, "XP", PlayerInfo[MAX_PLAYERS][XP]);
105 dini_IntSet(Accounts, "Skinas", PlayerInfo[MAX_PLAYERS][Skinas]);
106 dini_IntSet(Accounts, "Pinigai", PlayerInfo[MAX_PLAYERS][Pinigai]);
107 dini_IntSet(Accounts, "Administratorius", PlayerInfo[MAX_PLAYERS][Administratorius]);
108 dini_IntSet(Accounts, "AdminLevel", PlayerInfo[MAX_PLAYERS][AdminLevel]);
109 dini_IntSet(Accounts, "Gyvybe", PlayerInfo[MAX_PLAYERS][Heath]);
110 dini_IntSet(Accounts, "Sarvai", PlayerInfo[MAX_PLAYERS][Armour]);
111 dini_IntSet(Accounts, "PozicijaX", PlayerInfo[MAX_PLAYERS][pX]);
112 dini_IntSet(Accounts, "PozicijaY", PlayerInfo[MAX_PLAYERS][pY]);
113 dini_IntSet(Accounts, "PozicijaZ", PlayerInfo[MAX_PLAYERS][pZ]);
114 dini_IntSet(Accounts, "Ginklai", PlayerInfo[MAX_PLAYERS][Ginklai]);
115 dini_IntSet(Accounts, "VIP", PlayerInfo[MAX_PLAYERS][VIP]);
116 dini_IntSet(Accounts, "VIPLevel", PlayerInfo[MAX_PLAYERS][VIPLevel]);

Calisthenics
23/06/2018, 11:09 AM
You are meant to use playerid as index not MAX_PLAYERS which is out of bounds as the error informs you.

Heress
23/06/2018, 11:22 AM
so i must MAX_PLAYERS change to playerid?

Calisthenics
23/06/2018, 11:29 AM
In these lines you received the error, the ID of the player must be used instead. Depending on where the code is actually located, there will be a way to determinate the ID of the player.

Let's say the code is located in OnPlayerDisconnect which uses playerid as a way to indicate the player who disconnected therefore you need to use playerid, yes.

Heress
23/06/2018, 11:36 AM
In these lines you received the error, the ID of the player must be used instead. Depending on where the code is actually located, there will be a way to determinate the ID of the player.

Let's say the code is located in OnPlayerDisconnect which uses playerid as a way to indicate the player who disconnected therefore you need to use playerid, yes.

I changed and I got anothers errors:
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(109) : warning 213: tag mismatch
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(110) : warning 213: tag mismatch
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(111) : warning 213: tag mismatch
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(112) : warning 213: tag mismatch
C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(113) : warning 213: tag mismatch

code 96-117 lines:
https://pastebin.com/Lqg0LcVr

Calisthenics
23/06/2018, 11:39 AM
Because position and health/armor are floating-point numbers.


dini_IntSet(Accounts, "Gyvybe", PlayerInfo[playerid][Health]);
dini_IntSet(Accounts, "Sarvai", PlayerInfo[playerid][Armour]);
dini_IntSet(Accounts, "PozicijaX", PlayerInfo[playerid][pX]);
dini_IntSet(Accounts, "PozicijaY", PlayerInfo[playerid][pY]);
dini_IntSet(Accounts, "PozicijaZ", PlayerInfo[playerid][pZ]);

In the lines above, change dini_IntSet to dini_FloatSet

Heress
23/06/2018, 11:48 AM
great, now i have some new lines and new warning :D

How to GetPlayerWeapon and write 3 argument(ammo)?

C:\Users\Nerijus\Desktop\Serveris\gamemodes\999.pw n(152) : warning 202: number of arguments does not match definition

code 140-154 lines:
https://pastebin.com/LYLiHYd2

Calisthenics
23/06/2018, 11:57 AM
GetPlayerWeapon returns the current weapon the player is holding.
GetPlayerAmmo returns the current ammo of the weapon the player is holding.

You need to save the ammo as well and after loading:

GivePlayerWeapon(playerid, PlayerInfo[playerid][Ginklai], PlayerInfo[playerid][ammo_here]);

Heress
23/06/2018, 12:02 PM
GetPlayerWeapon returns the current weapon the player is holding.
GetPlayerAmmo returns the current ammo of the weapon the player is holding.

You need to save the ammo as well and after loading:

GivePlayerWeapon(playerid, PlayerInfo[playerid][Ginklai], PlayerInfo[playerid][ammo_here]);


Thanks!
Now I have this:
https://imgur.com/a/PYW1Qca