Help with 2 errors - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with 2 errors (
/showthread.php?tid=391971)
Help with 2 errors -
Desi_Dude - 12.11.2012
I am getting these 2 error.,
Can anyone figure it out and help me ?
Код:
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(824) : error 017: undefined symbol "SLOTS"
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(824) : error 009: invalid array size (negative, zero or out of bounds)
Код:
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
Re: Help with 2 errors -
XtremeR - 12.11.2012
at the top of it write
new SLOTS;
Re: Help with 2 errors -
Desi_Dude - 12.11.2012
Quote:
Originally Posted by XtremeR
at the top of it write
new SLOTS;
|
Still having them
Код:
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(825) : error 008: must be a constant expression; assumed zero
C:\Documents and Settings\User\Desktop\New Folder\xx\xxx.pwn(825) : error 009: invalid array size (negative, zero or out of bounds)
This is the part
Код:
forward UpdateSpeed(playerid);
enum SavePlayerPosEnum {
Float:LastX,
Float:LastY,
Float:LastZ
}
public UpdateSpeed(playerid)
{
new Float:x,Float:y,Float:z;
new Float:distance,value;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
// Distance: meters in the last second
value = floatround(distance * 3600);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
distance1[i] = floatround(value/1600);
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
Re: Help with 2 errors -
Konstantinos - 12.11.2012
Quote:
Originally Posted by XtremeR
at the top of it write
new SLOTS;
|
No.
pawn Код:
// At the top, under '#include (s)'
#define SLOTS 50 // Change it to your slots you want!
pawn Код:
enum SavePlayerPosEnum
{
Float:LastX,
Float:LastY,
Float:LastZ
};
new
SavePlayerPos[SLOTS][SavePlayerPosEnum]
;
Re: Help with 2 errors -
Desi_Dude - 12.11.2012
Quote:
Originally Posted by Dwane
No.
pawn Код:
// At the top, under '#include (s)' #define SLOTS 50 // Change it to your slots you want!
pawn Код:
enum SavePlayerPosEnum { Float:LastX, Float:LastY, Float:LastZ }; new SavePlayerPos[SLOTS][SavePlayerPosEnum] ;
|
Got another 2 errors.
Код:
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(827) : error 017: undefined symbol "SavePlayerPosEnum"
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(827) : error 009: invalid array size (negative, zero or out of bounds)
Re: Help with 2 errors -
Konstantinos - 12.11.2012
Show lines 826-828.
Re: Help with 2 errors -
Desi_Dude - 12.11.2012
Quote:
Originally Posted by Dwane
Show lines 826-828.
|
Код:
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
new restarting; //This one isnt concerning this thing :o..
Re: Help with 2 errors -
Konstantinos - 12.11.2012
Do you have this
pawn Код:
enum SavePlayerPosEnum
{
Float:LastX,
Float:LastY,
Float:LastZ
};
before that line?
pawn Код:
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
If you have the enum after the variable, it will keep giving you error.
Re: Help with 2 errors -
Desi_Dude - 12.11.2012
Quote:
Originally Posted by Dwane
Do you have this
pawn Код:
enum SavePlayerPosEnum { Float:LastX, Float:LastY, Float:LastZ };
before that line?
pawn Код:
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
If you have the enum after the variable, it will keep giving you error.
|
Fixed all right , thanks foh explainin

Appriciated ur help
Re: Help with 2 errors -
DamienWalter - 28.04.2013
Hey Help please i got this Error too
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(827) : error 017: undefined symbol "SavePlayerPosEnum"
C:\Documents and Settings\User\Desktop\xx\xxx.pwn(827) : error 009: invalid array size (negative, zero or out of bounds)