PDA

View Full Version : Crazy Errors. How to fix?


dudaefj
18/01/2012, 08:49 AM
If I just compile my gamemode, it compiles without any problem, ok.

but, if I do something like that:

new loja[600];
strcat(loja,"1.\tPadaria\n2.\tBinco\n3.\t24/7 Los Santos Loja 1\n4.\t24/7 Los Santos Loja 2\n5.\t24/7 Los Santos Loja 3\n6.\t24/7 Los Santos Loja 4\n7.\t24/7 Los Santos Loja 5\n8.\tCluckin Bell LS\n9.\tCluckin Bell LV 1\n10.\tCluckin Bell LV 2");
strcat(loja,"\n11.\tCluckin Bell LV 3\n12.\tBurguer Shot LS Norte\n13.\tBurguer Shot LS Sul\n14.\tBurguer Shot LV 1\n15.\tBurguer Shot LV 2\n16.\tBurguer Shot LV 3\n17.\t1Burguer Shot LV 4\n18.\tPizzaria LS\n19.\tPizzaria LV 1");
strcat(loja,"\n20.\tPizzaria LV 2\n21.\tPizzaria LV 3");
ShowPlayerDialog(playerid,DIALOG_GPS_LOJAS, DIALOG_STYLE_LIST,"{00ff00}G.P.S. {ff0000}BSL{00ff00} Lojas:",loja,"Selecionar","Voltar");

it gets 26+ errors
crazy things, like:

C:\sampserver\pawno\include\DOF2.inc(460) : warning 219: local variable "i" shadows a variable at a preceding level
C:\sampserver\pawno\include\DOF2.inc(569) : warning 219: local variable "i" shadows a variable at a preceding level
C:\sampserver\pawno\include\DOF2.inc(676) : warning 219: local variable "buf" shadows a variable at a preceding level



of course I've done a lot of tests and I know it is cuz long string on "ShowPlayerDialog"
ok

but, how can I use a long string on "ShowPlayerDialog"?

I've seen 80+ listitens on NG:RP (typing /setstation -> listitem 0)

so, it's not impossible
so, how to do that?

thimo
18/01/2012, 08:52 AM
Change i to j and change buf to bef :p

dudaefj
18/01/2012, 08:54 AM
are you kidding, right?

thimo
18/01/2012, 08:55 AM
Err im not... This will fix the I and the buf things :|

T0pAz
18/01/2012, 08:56 AM
This error means that a variable has been declared more than one. Make use of the search function to find the variable.

dudaefj
18/01/2012, 09:00 AM
lol

please, read all the issue guys...

if It would be the problem
the gamemode won't compile before add the "showplayerdialog"...

I told: IT COMPILES GOOD, I mean: without any error.
after add "new loja[600]" and put it on "showplayerdialog", the issue comes.
if there was any "i" or "buf" declared twice, it wouldn't compile before adding that code lol


every amateur scripter knows that it happens on pawn when you try to put a long string on showplayerdialog

I just wanna know the fix for it... =\

MasterJoker
18/01/2012, 09:10 AM
i know your Bumping please stop bumping only bump after 48 hours i know your bumping don't hide it

T0pAz
18/01/2012, 09:10 AM
lol

please, read all the issue guys...

if It would be the problem
the gamemode won't compile before add the "showplayerdialog"...

I told: IT COMPILES GOOD, I mean: without any error.
after add "new loja[600]" and put it on "showplayerdialog", the issue comes.
if there was any "i" or "buf" declared twice, it wouldn't compile before adding that code lol


every amateur scripter knows that it happens on pawn when you try to put a long string on showplayerdialog

I just wanna know the fix for it... =\

Oooh dear. local variable "x" shadows a variable at a preceding level means that a variable has been declared more than once if that was your warning.

dudaefj
18/01/2012, 09:18 AM
not everything is as it seems.

try to put on "ongamemodeinit()"
playerid = createobject(0,0,0,0,0,0,0);


you will probably get "playerid shadows a variable a precending level" (something like that) in a lot of differents funcionts
even it wasn't declared on a precending level.


or u can try what I've done too, you can see even a right variable will get the same error

probably it is cuz the way the native "showplayerdialog" has been done, when the limit of their string breaks it makes crazy things

I really don't know why, but I would like to know how to fix that.

T0pAz
18/01/2012, 09:22 AM
not everything is as it seems.

try to put on "ongamemodeinit()"
playerid = createobject(0,0,0,0,0,0,0);


you will probably get "playerid shadows a variable a precending level" (something like that) in a lot of differents funcionts
even it wasn't declared on a precending level.


or u can try what I've done too, you can see even a right variable will get the same error

probably it is cuz the way the native "showplayerdialog" has been done, when the limit of their string breaks it makes crazy things

I really don't know why, but I would like to know how to fix that.

It will give

undefined symbol "playerid"

Not

local variable "x" shadows a variable at a preceding level


because you are assigning an unassigned integer value to another value.

dudaefj
18/01/2012, 09:26 AM
you will get the both...


C:\GTA\GTA III - San Andreas\Samp Server\BBL\GM\gamemodes\BBL.pwn(1721) : warning 219: local variable "playerid" shadows a variable at a preceding level
C:\GTA\GTA III - San Andreas\Samp Server\BBL\GM\gamemodes\BBL.pwn(2662) : error 017: undefined symbol "playerid"
C:\GTA\GTA III - San Andreas\Samp Server\BBL\GM\gamemodes\BBL.pwn(4656) : warning 219: local variable "playerid" shadows a variable at a preceding level

T0pAz
18/01/2012, 09:29 AM
you will get the both...


C:\GTA\GTA III - San Andreas\Samp Server\BBL\GM\gamemodes\BBL.pwn(1721) : warning 219: local variable "playerid" shadows a variable at a preceding level
C:\GTA\GTA III - San Andreas\Samp Server\BBL\GM\gamemodes\BBL.pwn(2662) : error 017: undefined symbol "playerid"
C:\GTA\GTA III - San Andreas\Samp Server\BBL\GM\gamemodes\BBL.pwn(4656) : warning 219: local variable "playerid" shadows a variable at a preceding level

But I am not getting it. It's more likely a problem on your code and it's solution is mentioned before.

dudaefj
18/01/2012, 09:32 AM
so, why the problem disappear after erase the showplayerdialog line?