Error...
#1

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
Reply
#2

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.
Reply
#3

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

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

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

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";

Reply
#6

I got it, +REP, Thank's.
Reply
#7

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])
    { 
Reply
#8

change by this

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

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])
    { 
Reply
#10

Hello!

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

Mencent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)