SA-MP Forums Archive
Crazy Errors. How to fix? - 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: Crazy Errors. How to fix? (/showthread.php?tid=311751)



Crazy Errors. How to fix? - dudaefj - 18.01.2012

If I just compile my gamemode, it compiles without any problem, ok.

but, if I do something like that:

PHP код:
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_LOJASDIALOG_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?


Re: Crazy Errors. How to fix? - thimo - 18.01.2012

Change i to j and change buf to bef


Re: Crazy Errors. How to fix? - dudaefj - 18.01.2012

are you kidding, right?


Re: Crazy Errors. How to fix? - thimo - 18.01.2012

Err im not... This will fix the I and the buf things


Re: Crazy Errors. How to fix? - T0pAz - 18.01.2012

This error means that a variable has been declared more than one. Make use of the search function to find the variable.


Re: Crazy Errors. How to fix? - dudaefj - 18.01.2012

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... =\


Re: Crazy Errors. How to fix? - MasterJoker - 18.01.2012

i know your Bumping please stop bumping only bump after 48 hours i know your bumping don't hide it


Re: Crazy Errors. How to fix? - T0pAz - 18.01.2012

Quote:
Originally Posted by dudaefj
Посмотреть сообщение
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.


Re: Crazy Errors. How to fix? - dudaefj - 18.01.2012

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.


Re: Crazy Errors. How to fix? - T0pAz - 18.01.2012

Quote:
Originally Posted by dudaefj
Посмотреть сообщение
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.