Declaration locar variable error
#1

Код:
error 003: declaration of a local variable must appear in a compound block
The error is for 'new string[20];'
pawn Код:
if(!udb_Exists(PlayerName2(playerid)))
    //SendClientMessage(playerid,orange, "SERVER: Your account is not registered, please register by spawning your character.");
    new string[20];
     format(string, sizeof(string), "Register new Account: '%s'\n\nEnter the password to Register your Account:",pName(playerid));
    ShowPlayerDialog(playerid,DIALOGID+66,DIALOG_STYLE_INPUT,"Register Account",string,"Register","Quit");
So, could anyone be so kind to give me a helping hand on why it doesn't work?
Reply
#2

you can try putting brackets around your if function
pawn Код:
if(!udb_Exists(PlayerName2(playerid)))
{
    //SendClientMessage(playerid,orange, "SERVER: Your account is not registered, please register by spawning your character.");
    new string[20];
     format(string, sizeof(string), "Register new Account: '%s'\n\nEnter the password to Register your Account:",pName(playerid));
    ShowPlayerDialog(playerid,DIALOGID+66,DIALOG_STYLE_INPUT,"Register Account",string,"Register","Quit");
}
Reply
#3

Try this:
Код:
if(!udb_Exists(PlayerName2(playerid)))
{
    //SendClientMessage(playerid,orange, "SERVER: Your account is not registered, please register by spawning your character.");
}else{
    new string[20];
     format(string, sizeof(string), "Register new Account: '%s'\n\nEnter the password to Register your Account:",pName[playerid]);
    ShowPlayerDialog(playerid,DIALOGID+66,DIALOG_STYLE_INPUT,"Register Account",string,"Register","Quit");
}
Reply
#4

Quote:
Originally Posted by Plovix
Посмотреть сообщение
Try this:
Код:
if(!udb_Exists(PlayerName2(playerid)))
{
    //SendClientMessage(playerid,orange, "SERVER: Your account is not registered, please register by spawning your character.");
}else{
    new string[20];
     format(string, sizeof(string), "Register new Account: '%s'\n\nEnter the password to Register your Account:",pName[playerid]);
    ShowPlayerDialog(playerid,DIALOGID+66,DIALOG_STYLE_INPUT,"Register Account",string,"Register","Quit");
}
Dude, check your code. It really doesn't make any sense. Go over it and you'll find out why
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)