4 Error help -
vn007322815 - 19.03.2015
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case REGISTER_MENU:
{
new string[150];
if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You MUST provide a password.") && format(string,sizeof(string),"Welcome to New Vegas %s!\n\nYour not registered yet, please enter a password below to register:", GetName(playerid)) && ShowPlayerDialog(playerid, REGISTER_MENU, DIALOG_STYLE_INPUT, "{FFFFFF}Register", string, "Register", "Quit");
if(strlen(inputtext) < 5 || strlen(inputtext) > 24) return SendClientMessage(playerid, RED, "> Your password can only contain 3-24 characters.") && format(string,sizeof(string),"{FFFFFF}Welcome to New Vegas %s!\n\nYour not registered yet, please enter a password below to register:", GetName(playerid)) && ShowPlayerDialog(playerid, REGISTER_MENU, DIALOG_STYLE_INPUT, "{FFFFFF}Register", string, "Register", "Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"pPass",udb_hash(inputtext));
INI_WriteInt(File,"Money",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Arrests",0);
INI_WriteInt(File,"Jailed",0);
INI_WriteInt(File,"Wanted",0);
INI_Close(File);
GivePlayerCash(playerid, 10000);
format(fstr, sizeof(fstr), "Server: Account registered! Welcome to Vegas %s.", GetName(playerid));
SendClientMessage(playerid, WHITE, fstr);
format(fstr2, sizeof(fstr2), "%s [%d] has registered.", GetName(playerid), playerid);
SendClientMessageToAll(LIGHTBLUE, fstr2);
ShowPlayerDialog(playerid, RULES_LIST, DIALOG_STYLE_MSGBOX ,
"{FF0000}NVCNR Server Rules",
"{FF0000}1: DONT use hacks/mods or bug abuse = ban + NO appeal!\n2: DONT DM, HK, PARK, CAMP or place RANDOM hits!\n3: DONT flame, insult, scam or troll!\n4: DONT spam, flood or advertise!\n5: DONT /q or pause to avoid anything!\n6: DONT team up with WANTED players as LAW ENFORCEMENT class!\n7: DONT complain about the server or ask for ANYTHING ingame!",
"Accept", "Decline");
}
}
case LOGIN_MENU:
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
format(fstr, sizeof(fstr), "Elvis: Login successful! Welcome back %s.", GetName(playerid));
SendClientMessage(playerid, WHITE, fstr);
format(fstr2, sizeof(fstr2), "%s [%d] has logged in.", GetName(playerid), playerid);
SendClientMessageToAll(LIGHTBLUE, fstr2);
}
else
{
SendClientMessage(playerid, RED, "Incorrect password.");
format(string, sizeof(string), "%s [%d] has been kicked from NVCNR - Reason: Incorrect password", GetName(playerid), playerid);
SendClientMessage(playerid, RED, string);
Kick(playerid);
}
return 1;
}
return 1;
}
Error :
Код:
C:\Users\jonh\Desktop\samp03z_svr_R1_win32\gamemodes\CNR.pwn(340) : warning 217: loose indentation
C:\Users\jonh\Desktop\samp03z_svr_R1_win32\gamemodes\CNR.pwn(340) : error 014: invalid statement; not in switch
C:\Users\jonh\Desktop\samp03z_svr_R1_win32\gamemodes\CNR.pwn(340) : warning 215: expression has no effect
C:\Users\jonh\Desktop\samp03z_svr_R1_win32\gamemodes\CNR.pwn(340) : error 001: expected token: ";", but found ":"
C:\Users\jonh\Desktop\samp03z_svr_R1_win32\gamemodes\CNR.pwn(340) : error 029: invalid expression, assumed zero
C:\Users\jonh\Desktop\samp03z_svr_R1_win32\gamemodes\CNR.pwn(340) : fatal error 107: too many error messages on one line
Re: 4 Error help -
CalvinC - 20.03.2015
Can you point out the error lines?
Respuesta: 4 Error help -
JuanStone - 20.03.2015
This cannot be done.
PHP код:
if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You MUST provide a password.") && format(string,sizeof(string),"Welcome to New Vegas %s!\n\nYour not registered yet, please enter a password below to register:", GetName(playerid)) && ShowPlayerDialog(playerid, REGISTER_MENU, DIALOG_STYLE_INPUT, "{FFFFFF}Register", string, "Register", "Quit");
And you need to check if there is a response in the dialog and it seems that forgot a bracket.
Try this:
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case REGISTER_MENU:
{
if(response == 1)
{
new string[150];
if(!strlen(inputtext))
{
SendClientMessage(playerid, RED, "You MUST provide a password.");
format(string,sizeof(string),"Welcome to New Vegas %s!\n\nYour not registered yet, please enter a password below to register:", GetName(playerid)) && ShowPlayerDialog(playerid, REGISTER_MENU, DIALOG_STYLE_INPUT, "{FFFFFF}Register", string, "Register", "Quit");
return true;
}
if(strlen(inputtext) < 5 || strlen(inputtext) > 24)
{
SendClientMessage(playerid, RED, "> Your password can only contain 3-24 characters.");
format(string,sizeof(string),"{FFFFFF}Welcome to New Vegas %s!\n\nYour not registered yet, please enter a password below to register:", GetName(playerid)) && ShowPlayerDialog(playerid, REGISTER_MENU, DIALOG_STYLE_INPUT, "{FFFFFF}Register", string, "Register", "Quit");
return true;
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"pPass",udb_hash(inputtext));
INI_WriteInt(File,"Money",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Arrests",0);
INI_WriteInt(File,"Jailed",0);
INI_WriteInt(File,"Wanted",0);
INI_Close(File);
GivePlayerCash(playerid, 10000);
format(fstr, sizeof(fstr), "Server: Account registered! Welcome to Vegas %s.", GetName(playerid));
SendClientMessage(playerid, WHITE, fstr);
format(fstr2, sizeof(fstr2), "%s [%d] has registered.", GetName(playerid), playerid);
SendClientMessageToAll(LIGHTBLUE, fstr2);
ShowPlayerDialog(playerid, RULES_LIST, DIALOG_STYLE_MSGBOX ,
"{FF0000}NVCNR Server Rules",
"{FF0000}1: DONT use hacks/mods or bug abuse = ban + NO appeal!\n2: DONT DM, HK, PARK, CAMP or place RANDOM hits!\n3: DONT flame, insult, scam or troll!\n4: DONT spam, flood or advertise!\n5: DONT /q or pause to avoid anything!\n6: DONT team up with WANTED players as LAW ENFORCEMENT class!\n7: DONT complain about the server or ask for ANYTHING ingame!",
"Accept", "Decline");
}
}
case LOGIN_MENU:
{
if(response == 1)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
format(fstr, sizeof(fstr), "Elvis: Login successful! Welcome back %s.", GetName(playerid));
SendClientMessage(playerid, WHITE, fstr);
format(fstr2, sizeof(fstr2), "%s [%d] has logged in.", GetName(playerid), playerid);
SendClientMessageToAll(LIGHTBLUE, fstr2);
}
else
{
SendClientMessage(playerid, RED, "Incorrect password.");
format(string, sizeof(string), "%s [%d] has been kicked from NVCNR - Reason: Incorrect password", GetName(playerid), playerid);
SendClientMessage(playerid, RED, string);
Kick(playerid);
}
return 1;
}
}
}
return true;
}