warning 219: local variable "Textdraw0" shadows a variable at a preceding level
#1

Hello, I have a problem with this:

Script
Код:
new Text:Textdraw0;
new Text:Textdraw1;

Textdraw0 = TextDrawCreate(565.000000, 430.177886, "EAGLES");
	TextDrawLetterSize(Textdraw0, 0.431499, 1.913555);
	TextDrawAlignment(Textdraw0, 1);
	TextDrawColor(Textdraw0, -1);
	TextDrawSetOutline(Textdraw0, -1);
	TextDrawBackgroundColor(Textdraw0, 255);
	TextDrawFont(Textdraw0, 1);
	TextDrawSetProportional(Textdraw0, 1);

	Textdraw1 = TextDrawCreate(611.739746, 430.166992, "~g~.RO");
	TextDrawLetterSize(Textdraw1, 0.431499, 1.932000);
	TextDrawAlignment(Textdraw1, 1);
	TextDrawColor(Textdraw1, -1);
	TextDrawSetOutline(Textdraw1, -1);
	TextDrawBackgroundColor(Textdraw1, 255);
	TextDrawFont(Textdraw1, 1);
	TextDrawSetProportional(Textdraw1, 1);

	new PlayerText:Textdraw0[MAX_PLAYERS];          LINE 120

	Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 634.500000, 418.355743, "~g~SAPHIRE~w~_/_Mr_Marius");
	PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.265500, 1.506666);
	PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 2);
	PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);
	PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 255);
	PlayerTextDrawFont(playerid, Textdraw0[playerid], 1);
	PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
Error
Код:
(120) : warning 219: local variable "Textdraw0" shadows a variable at a preceding level
Reply
#2

You're defining the variable Textdraw0 twice.

PHP код:
    new PlayerText:PlayerTextdraw0[MAX_PLAYERS];          LINE 120

    PlayerTextdraw0
[playerid] = CreatePlayerTextDraw(playerid634.500000418.355743"~g~SAPHIRE~w~_/_Mr_Marius");
    
PlayerTextDrawLetterSize(playeridPlayerTextdraw0[playerid], 0.2655001.506666);
    
PlayerTextDrawAlignment(playeridPlayerTextdraw0[playerid], 2);
    
PlayerTextDrawColor(playeridPlayerTextdraw0[playerid], -1);
    
PlayerTextDrawSetOutline(playeridPlayerTextdraw0[playerid], 1);
    
PlayerTextDrawBackgroundColor(playeridPlayerTextdraw0[playerid], 255);
    
PlayerTextDrawFont(playeridPlayerTextdraw0[playerid], 1);
    
PlayerTextDrawSetProportional(playeridPlayerTextdraw0[playerid], 1); 
Reply
#3

Thanks!
Reply
#4

I have a new problem with this:

Script
Код:
new string[100], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "~g~SAPHIRE~w~_/_%s", name);
    PlayerTextDrawSetString(playerid, Textdraw1, string);              LINE 144
    PlayerTextDrawShow(playerid, Textdraw1);                              LINE 145
Error
Код:
(144) : warning 213: tag mismatch
(145) : warning 213: tag mismatch
Reply
#5

You forgot [playerid] at the end of the TextDraw1
Reply
#6

You gotta see the difference between what a global and what a player text draw is, here's the facts:

Player Text Draws:
Код:
PlayerText: variableName
PlayerTextDraw(show, etc etc)
- Usually the variable is an array.
Global Text Draws:
Код:
Text: variableName
TextDraw(ShowForPlayer, etc etc)
- Usually is a single variable with no second-hand array parameter.
The easy fix for your script is:
PHP код:
    PlayerTextDrawSetString(playeridPlayerTextdraw0[playerid], string);              LINE 144
    PlayerTextDrawShow
(playeridPlayerTextdraw0[playerid]);                              LINE 145 
Reply
#7

Quote:
Originally Posted by Meller
Посмотреть сообщение
You gotta see the difference between what a global and what a player text draw is, here's the facts:

Player Text Draws:
Код:
PlayerText: variableName
PlayerTextDraw(show, etc etc)
- Usually the variable is an array.
Global Text Draws:
Код:
Text: variableName
TextDraw(ShowForPlayer, etc etc)
- Usually is a single variable with no second-hand array parameter.
The easy fix for your script is:
PHP код:
    PlayerTextDrawSetString(playeridPlayerTextdraw0[playerid], string);              LINE 144
    PlayerTextDrawShow
(playeridPlayerTextdraw0[playerid]);                              LINE 145 
Nope, this give me 4 errors:

Reply
#8

Then your variable is a local one, define the new PlayerTextdraw0[MAX_PLAYERS]; outside the callbacks.
Reply
#9

Quote:
Originally Posted by Meller
Посмотреть сообщение
Then your variable is a local one, define the new PlayerTextdraw0[MAX_PLAYERS]; outside the callbacks.
And now? (Sorry for the many questions I asked, but I'm a beginner.)

Reply
#10

Your variable is still local.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)