public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new File[50];
format(File, sizeof(File), PFiles, pName(playerid));
switch(dialogid)
{
case LOGIN:
{
if(response)
{
if(strlen(inputtext) == 0)
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave");
}
if(strcmp(inputtext, dj(File, "Password", 40), true) == 0)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now logged in!");
PVar[playerid][pKills] = djInt (File, "Kills");
PVar[playerid][pDeaths] = djInt (File, "Deaths");
PVar[playerid][pLevel] = djInt (File, "Level");
PVar[playerid][pMuted] = djInt (File, "Muted");
format(PVar[playerid][pMutedReason], 52, "%s", dj(File, "MutedReason"));
PVar[playerid][pLastX] = djFloat (File, "LastX");
PVar[playerid][pLastY] = djFloat (File, "LastY");
PVar[playerid][pLastZ] = djFloat (File, "LastZ");
}
else
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave");
}
}
else Kick(playerid);
}
case REGISTER:
{
if(response)
{
if(strlen(inputtext) == 0)
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome: "#CDGREEN"%s(%d)\n"#CBLUE"This account has not been registered! Please enter a password:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, ""#CDGREEN"Register", iStr, "Register", "Leave");
}
djCreateFile(File);
djSet (File, "Password", inputtext);
djSetInt (File, "Kills", 0);
djSetInt (File, "Deaths", 0);
djSetInt (File, "Level", 0);
djSetInt (File, "Muted", 0);
djSet (File, "MutedReason", "Not Muted!");
djSetFloat (File, "LastX", 0.0);
djSetFloat (File, "LastY", 0.0);
djSetFloat (File, "LastZ", 0.0);
djCommit(File);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have been registered and logged in!");
}
else Kick(playerid);
}
case DIALOG_VEH:
{
new VehicleID;
VehicleID = GetVehicleModelIDFromName(inputtext);
if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
VehicleID != 430 && VehicleID != 417 && VehicleID != 435 &&
VehicleID != 446 && VehicleID != 449 && VehicleID != 450 &&
VehicleID != 452 && VehicleID != 453 && VehicleID != 454 &&
VehicleID != 460 && VehicleID != 464 && VehicleID != 465 &&
VehicleID != 469 && VehicleID != 472 && VehicleID != 473 &&
VehicleID != 476 && VehicleID != 484 && VehicleID != 487 &&
VehicleID != 488 && VehicleID != 493 && VehicleID != 497 &&
VehicleID != 501 && VehicleID != 511 && VehicleID != 512 &&
VehicleID != 513 && VehicleID != 519 && VehicleID != 520 &&
VehicleID != 537 && VehicleID != 538 && VehicleID != 548 &&
VehicleID != 553 && VehicleID != 563 && VehicleID != 564 &&
VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
VehicleID != 584 && VehicleID != 590 && VehicleID != 591 &&
VehicleID != 592 && VehicleID != 593 && VehicleID != 594 &&
VehicleID != 595 && VehicleID != 606 && VehicleID != 607 &&
VehicleID != 608 && VehicleID != 610 && VehicleID != 611) {
if(VehicleID == -1 )
{
VehicleID = strval(inputtext);
if(VehicleID < 400 || VehicleID > 611 )
{
return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid vehiclename!");
}
}
GetPlayerPos(playerid, pX, pY, pZ);
GetPlayerFacingAngle(playerid, pAngle);
DestroyVehicle(PVar[playerid][pSpawnVehicle]);
PVar[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, 0, 0, -1);
LinkVehicleToInterior(PVar[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, PVar[playerid][pSpawnVehicle], 0);
}
}
return 0;
}
C:\Users\Bradley\Desktop\BradRP\gamemodes\Blank.pwn(722) : error 002: only a single statement (or expression) can follow each "case" C:\Users\Bradley\Desktop\BradRP\gamemodes\Blank.pwn(722) : warning 215: expression has no effect C:\Users\Bradley\Desktop\BradRP\gamemodes\Blank.pwn(723) : warning 209: function "OnDialogResponse" should return a value Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new File[50]; format(File, sizeof(File), PFiles, pName(playerid)); switch(dialogid) { case LOGIN: { if(response) { if(strlen(inputtext) == 0) { new iStr[128]; format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid); return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave"); } if(strcmp(inputtext, dj(File, "Password", 40), true) == 0) { SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now logged in!"); PVar[playerid][pKills] = djInt (File, "Kills"); PVar[playerid][pDeaths] = djInt (File, "Deaths"); PVar[playerid][pLevel] = djInt (File, "Level"); PVar[playerid][pMuted] = djInt (File, "Muted"); format(PVar[playerid][pMutedReason], 52, "%s", dj(File, "MutedReason")); PVar[playerid][pLastX] = djFloat (File, "LastX"); PVar[playerid][pLastY] = djFloat (File, "LastY"); PVar[playerid][pLastZ] = djFloat (File, "LastZ"); } else { new iStr[128]; format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid); return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave"); } } else Kick(playerid); }} case REGISTER: { if(response) { if(strlen(inputtext) == 0) { new iStr[128]; format(iStr, sizeof(iStr), ""#CBLUE"Welcome: "#CDGREEN"%s(%d)\n"#CBLUE"This account has not been registered! Please enter a password:", pName(playerid), playerid); return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, ""#CDGREEN"Register", iStr, "Register", "Leave"); } djCreateFile(File); djSet (File, "Password", inputtext); djSetInt (File, "Kills", 0); djSetInt (File, "Deaths", 0); djSetInt (File, "Level", 0); djSetInt (File, "Muted", 0); djSet (File, "MutedReason", "Not Muted!"); djSetFloat (File, "LastX", 0.0); djSetFloat (File, "LastY", 0.0); djSetFloat (File, "LastZ", 0.0); djCommit(File); SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have been registered and logged in!"); } else Kick(playerid); }} case DIALOG_VEH: { new VehicleID; VehicleID = GetVehicleModelIDFromName(inputtext); if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 && VehicleID != 430 && VehicleID != 417 && VehicleID != 435 && VehicleID != 446 && VehicleID != 449 && VehicleID != 450 && VehicleID != 452 && VehicleID != 453 && VehicleID != 454 && VehicleID != 460 && VehicleID != 464 && VehicleID != 465 && VehicleID != 469 && VehicleID != 472 && VehicleID != 473 && VehicleID != 476 && VehicleID != 484 && VehicleID != 487 && VehicleID != 488 && VehicleID != 493 && VehicleID != 497 && VehicleID != 501 && VehicleID != 511 && VehicleID != 512 && VehicleID != 513 && VehicleID != 519 && VehicleID != 520 && VehicleID != 537 && VehicleID != 538 && VehicleID != 548 && VehicleID != 553 && VehicleID != 563 && VehicleID != 564 && VehicleID != 569 && VehicleID != 570 && VehicleID != 577 && VehicleID != 584 && VehicleID != 590 && VehicleID != 591 && VehicleID != 592 && VehicleID != 593 && VehicleID != 594 && VehicleID != 595 && VehicleID != 606 && VehicleID != 607 && VehicleID != 608 && VehicleID != 610 && VehicleID != 611) { if(VehicleID == -1 ) { VehicleID = strval(inputtext); if(VehicleID < 400 || VehicleID > 611 ) { return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid vehiclename!"); } } GetPlayerPos(playerid, pX, pY, pZ); GetPlayerFacingAngle(playerid, pAngle); DestroyVehicle(PVar[playerid][pSpawnVehicle]); PVar[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, 0, 0, -1); LinkVehicleToInterior(PVar[playerid][pSpawnVehicle], GetPlayerInterior(playerid)); PutPlayerInVehicle(playerid, PVar[playerid][pSpawnVehicle], 0); } } return 0; }
C:\Users\Bradley\Desktop\BradRP\gamemodes\Blank.pwn(716) : error 002: only a single statement (or expression) can follow each "case" C:\Users\Bradley\Desktop\BradRP\gamemodes\Blank.pwn(716) : warning 215: expression has no effect C:\Users\Bradley\Desktop\BradRP\gamemodes\Blank.pwn(717) : warning 209: function "OnDialogResponse" should return a value
if(dialogid == (here dialog id or name )
{
//codes
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new File[50]; format(File, sizeof(File), PFiles, pName(playerid)); switch(dialogid) { case LOGIN: { if(response) { if(strlen(inputtext) == 0) { new iStr[128]; format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid); return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave"); } if(strcmp(inputtext, dj(File, "Password", 40), true) == 0) { SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now logged in!"); PVar[playerid][pKills] = djInt (File, "Kills"); PVar[playerid][pDeaths] = djInt (File, "Deaths"); PVar[playerid][pLevel] = djInt (File, "Level"); PVar[playerid][pMuted] = djInt (File, "Muted"); format(PVar[playerid][pMutedReason], 52, "%s", dj(File, "MutedReason")); PVar[playerid][pLastX] = djFloat (File, "LastX"); PVar[playerid][pLastY] = djFloat (File, "LastY"); PVar[playerid][pLastZ] = djFloat (File, "LastZ"); } else { new iStr[128]; format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid); return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave"); } } else Kick(playerid); }} case REGISTER: { if(response) { if(strlen(inputtext) == 0) { new iStr[128]; format(iStr, sizeof(iStr), ""#CBLUE"Welcome: "#CDGREEN"%s(%d)\n"#CBLUE"This account has not been registered! Please enter a password:", pName(playerid), playerid); return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, ""#CDGREEN"Register", iStr, "Register", "Leave"); } djCreateFile(File); djSet (File, "Password", inputtext); djSetInt (File, "Kills", 0); djSetInt (File, "Deaths", 0); djSetInt (File, "Level", 0); djSetInt (File, "Muted", 0); djSet (File, "MutedReason", "Not Muted!"); djSetFloat (File, "LastX", 0.0); djSetFloat (File, "LastY", 0.0); djSetFloat (File, "LastZ", 0.0); djCommit(File); SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have been registered and logged in!"); } else Kick(playerid); }} case DIALOG_VEH: { new VehicleID; VehicleID = GetVehicleModelIDFromName(inputtext); if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 && VehicleID != 430 && VehicleID != 417 && VehicleID != 435 && VehicleID != 446 && VehicleID != 449 && VehicleID != 450 && VehicleID != 452 && VehicleID != 453 && VehicleID != 454 && VehicleID != 460 && VehicleID != 464 && VehicleID != 465 && VehicleID != 469 && VehicleID != 472 && VehicleID != 473 && VehicleID != 476 && VehicleID != 484 && VehicleID != 487 && VehicleID != 488 && VehicleID != 493 && VehicleID != 497 && VehicleID != 501 && VehicleID != 511 && VehicleID != 512 && VehicleID != 513 && VehicleID != 519 && VehicleID != 520 && VehicleID != 537 && VehicleID != 538 && VehicleID != 548 && VehicleID != 553 && VehicleID != 563 && VehicleID != 564 && VehicleID != 569 && VehicleID != 570 && VehicleID != 577 && VehicleID != 584 && VehicleID != 590 && VehicleID != 591 && VehicleID != 592 && VehicleID != 593 && VehicleID != 594 && VehicleID != 595 && VehicleID != 606 && VehicleID != 607 && VehicleID != 608 && VehicleID != 610 && VehicleID != 611) { if(VehicleID == -1 ) { VehicleID = strval(inputtext); if(VehicleID < 400 || VehicleID > 611 ) { return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid vehiclename!"); } } GetPlayerPos(playerid, pX, pY, pZ); GetPlayerFacingAngle(playerid, pAngle); DestroyVehicle(PVar[playerid][pSpawnVehicle]); PVar[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, 0, 0, -1); LinkVehicleToInterior(PVar[playerid][pSpawnVehicle], GetPlayerInterior(playerid)); PutPlayerInVehicle(playerid, PVar[playerid][pSpawnVehicle], 0); } } return 0; } |