Symbol already defined problem
#1

Hello.

I have a problem with variables in dialogs. I have dialog with id 136 and this code if player press response:

PHP код:
            new
                
header70 ];
            if ( !
privatDBplayerid ][ Sunaikinta ] )
            {
                new
                    
enginelightsalarmdoorsbonnetbootobjective,
                    
stringas][ 30 ], formatas128 ], Float:vh;
                
GetVehicleParamsExprivatDBplayerid ][ pID ], enginelightsalarmdoorsbonnetbootobjective );
                if ( 
doors stringas] = "{FF0000}Atrakinti duris"; else stringas] = "{00FF00}Uzrakinti duris";
                if ( !
boot stringas] = "{FF0000}Atidaryti bagazine"; else stringas] = "{00FF00}Uzdaryti bagazine";
                
GetVehicleHealthprivatDBplayerid ][ pID ], vh );
                if ( 
vh >= 750.0 )
                    
formatheadersizeof header"%s valdymas - Health: {00FF00}%.0f%%"aVehicleNamesGetVehicleModelprivatDBplayerid ][ pID ] ) - 400 ], vh/10 );
                else if ( 
vh >= 500.0 )
                    
formatheadersizeof header"%s valdymas - Health: {f5db00}%.0f%%"aVehicleNamesGetVehicleModelprivatDBplayerid ][ pID ] ) - 400 ], vh/10 );
                else
                    
formatheadersizeof header"%s valdymas - Health: {ff0000}%.0f%%"aVehicleNamesGetVehicleModelprivatDBplayerid ][ pID ] ) - 400 ], vh/10 );
                
formatformatassizeof formatas"%s\nKur mano transp.?\n%s\nParduoti transp."stringas], stringas] );
                
ShowPlayerDialogplayerid136DIALOG_STYLE_LISTheaderformatas"Rinktis""Uzdaryti" );
            }else{
                
formatheadersizeof header"%s valdymas - {FF0000}SUDAUZYTA"aVehicleNamesprivatDBplayerid ][ pModelis ] - 400 ] );
                
ShowPlayerDialogplayerid137DIALOG_STYLE_LISTheader"Sutaisyti transp.\nParduoti transp.""Rinktis""Uzdaryti" );
            } 
Then dialog with id 143 with exactly same code undder !response.

But if I want to compile .pwn file I get errors:

Код:
C:\Users\Gin\Desktop\Cyberplay server\Modas\gamemodes\GM.pwn(13203) : error 021: symbol already defined: "header"
C:\Users\Gin\Desktop\Cyberplay server\Modas\gamemodes\GM.pwn(13208) : error 021: symbol already defined: "engine"
Can someone tell me why I'm getting these errors?

I know, I can just change variable names, but I can't understand why I'm getting these errors, because variables are created in certain dialogs?

P.S. All brackets are closed! And if I disable this code in 136'th dialog, mod compiles sucessfully.
Reply
#2

Quote:
Originally Posted by Axuj
Посмотреть сообщение
I know, I can just change variable names, but I can't understand why I'm getting these errors, because variables are created in certain dialogs?.
No, because you defined them in global.
Reply
#3

What do you mean saying i've defined them in global? And when i defined them in global, then why are they working in dialog 136?
Reply
#4

Then either line 136 is the global definition, or the global definition is AFTER line 136.
Is line 136 included in any callback?
if not show the code of that line (10 lines above and under).
Reply
#5

It's not a line it's whole dialog in OnPlayerDialogResponse callback.

The first dialog, where variables are defined is ID 136 and the second dialog is ID 143.

And in the second dialog i get the errors, that variables are already defined but i can't understand WHY..? Because variables are not global.

EDIT: here are these two dialogs: http://pastebin.com/4KgnuwwR
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)