local variable "object" shadows a variable at a preceding level
#1

Well the title explains everything, I've put in my script a system where when the player dies they drop the weapon they're holding, and you use /pgun to pick it up..

Код:
local variable "object" shadows a variable at a preceding level
Reply
#2

You've declared it as a global and local variable.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You've declared it as a global and local variable.
Wait what? Now I'm even more confused.
Reply
#4

You have another
pawn Код:
new object
at the top of the script, Changing the local one's name should fix it.
Reply
#5

You have something like this:

pawn Код:
new object; //this is a global variable.
public OnPlayerText(playerid, text[])
{
    new object; //this is a local variable.
        //You can rename the local variable to fix this issue.
        //more code.
}

So:
public OnPlayerText(playerid, text[])
{
    new myobject; //this is a local variable.
        //You can rename the local variable to fix this issue.
        //more code.
}
Reply
#6

I'm going to give you the simplest example.

pawn Код:
#include < a_samp >

new
    sth // declared as global variable
;

main( ) { }

public OnGameModeInit( )
{
    new
        sth // declared as local variable
    ;
    // code
    return 1;
}
Reply
#7

Код:
C:\Documents and Settings\Ashley\Desktop\DSRP1\gamemodes\RZRP.pwn(96398) : error 017: undefined symbol "object"
C:\Documents and Settings\Ashley\Desktop\DSRP1\gamemodes\RZRP.pwn(96398) : warning 215: expression has no effect
C:\Documents and Settings\Ashley\Desktop\DSRP1\gamemodes\RZRP.pwn(96398) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Ashley\Desktop\DSRP1\gamemodes\RZRP.pwn(96398) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Ashley\Desktop\DSRP1\gamemodes\RZRP.pwn(96398) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

I assume you deleted the global one and it's used in another callbacks too?
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I assume you deleted the global one and it's used in another callbacks too?
The thing is tho, I don't find a local one.
Reply
#10

Try to put the global one again, Then compile and go to the line with error and rename it to something else ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)