SA-MP Forums Archive
Error... - 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: Error... (/showthread.php?tid=571024)



Error... - Brys - 15.04.2015

Error :
Код:
local variable "string" shadows a variable at a preceding level
Lines :

PHP код:
    ;
            if(
== -1) return 1;
            new 
string[128];
            if(
GarageInfo[i][GarageOwned]) return SendClientMessage(playeridGREY"Sorry, somebody already beat you to buying this garage.");
            if(
GetMoney(playerid) >= price)
            {
                if (
PlayerInfo[playerid][pGarageKey] == -1



Respuesta: Error... - JuanStone - 15.04.2015

Change:

PHP код:
new string[128]; 
by:

PHP код:
new string1[128]; 
And replaces all the lines in the function that use that string variable by string1, the problem is that you have two variables with the same name, a global and a local and the compiler does not know which one to use.


Re: Error... - Brys - 15.04.2015

I got this error like at 15 lines, do I need to fix them all to :

PHP код:
new string1 
PHP код:
new string2 
....and continue ?


Re: Error... - J4Rr3x - 15.04.2015

Just delete "new string[128];" or rename "string".


Respuesta: Error... - JuanStone - 15.04.2015

You must replace all the lines.

PHP код:
new string[10];

MyFunction(..)
{
    new 
string[10];
    
    
string "hello";
    
    
string "hello2";
    
    
string "hello3";

PHP код:
new string[10];

MyFunction(..)
{
    new 
string1[10];

    
string1 "hello";

    
string1 "hello2";

    
string1 "hello3";




Re: Error... - Brys - 15.04.2015

I got it, +REP, Thank's.


Re: Error... - Brys - 15.04.2015

I have other error by the way, can you help me with this ? ::

Error :
Код:
(3174) : error 017: undefined symbol "string"
(3174) : error 017: undefined symbol "string"
(3174) : error 029: invalid expression, assumed zero
(3174) : fatal error 107: too many error messages on one line
Line :
PHP код:
{
    new 
string1[64];
    
format(stringsizeof(string), "%s (Slot %d)"pClothingName[playerid][slot], slot 1);
    switch (
PlayerClothing[playerid][slot][pClothingAttached])
    { 



Respuesta: Error... - JuanStone - 15.04.2015

change by this

PHP код:
new string1[64];
format(string1sizeof(string1), "%s (Slot %d)"pClothingName[playerid][slot], slot+1); 



Re: Error... - Brys - 15.04.2015

I got this :
Код:
(3174) : error 029: invalid expression, assumed zero
(3174) : error 029: invalid expression, assumed zero
(3174 -- 3175) : warning 215: expression has no effect
(3175) : error 001: expected token: ";", but found "switch"
(3175) : fatal error 107: too many error messages on one line
code :
PHP код:
new string1[64];
    
format(string1sizeof(string1), "%s (Slot %d)"pClothingName[playerid][slot], slot+1);[/HP]
     switch (
PlayerClothing[playerid][slot][pClothingAttached])
    { 



AW: Error... - Mencent - 15.04.2015

Hello!

Can you send us more code?
Maybe the whole "switch"?

Mencent