10.11.2015, 05:09
I have a choose rank dialog,but it wont work when I click it.Here is the code :
and there is a loose indentation problem.I tried to fix it but it won't work at all.I like to make my scripts free any warning/error
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dialreg)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,dialreg,DIALOG_STYLE_PASSWORD,"Register","{FFFFFF}Welcome,\n\nThis account isn't {33CC33}registered !\n\n{FFFFFF}Enter your own {33CC33}password {FFFFFF}to create a new {33CC33}account !","Register","Quit");
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Admin Level",0);
INI_WriteInt(file,"Ranks",0);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Warns",0);
INI_Close(file);
ShowPlayerDialog(playerid,dialsuccess1,DIALOG_STYLE_MSGBOX,"Register","{33CC33}Congratulation,\n\n{FFFFFF}You have been successfully {33CC33}registered {FFFFFF}!","Okay","");
return 1;
}
}
if(dialogid == diallogin)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass, pInfo[playerid][Pass], false))
{
INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
SetPlayerScore(playerid,pInfo[playerid][Scores]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
ShowPlayerDialog(playerid,dialsuccess2,DIALOG_STYLE_MSGBOX,"Register","{33CC33}Congratulation,\n\n{FFFFFF}You have been successfully {33CC33}login {FFFFFF}!","Okay","");
}
else
{
ShowPlayerDialog(playerid,diallogin,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Sorry,\n\n{FF0000}Incorrect password {FFFFFF}!\n\n{FFFFFF}Please enter your {33CC33}password {FFFFFF}below !","Login","Quit");
}
}
if(dialogid == DIALOG_RANK)//loose indentation
{
if(!response) return ShowPlayerDialog(playerid,DIALOG_RANK,DIALOG_STYLE_LIST,"Choose your rank","{FF80FF}Leader {FFFFFF}~ Rank 3\n{33CC33}CO-Leader {FFFFFF}~ Rank 2\n{FF0000}Elder {FFFFFF}~ Rank 1\n{33CC33}Guest {FFFFFF}~ Rank 0","Choose","");
if(response)
{
if(listitem == 0) //LEADER = Police
{
AddPlayerClass(137,1574.9681,-1635.9956,13.5509,87.9275,0,0,0,0,0,0); // LSPD
SendClientMessage(playerid, 0xFFFFFFAA, "** Welcome {33CC33}SoD Leader {FFFFFF}**");
}
if(listitem == 1)//CO-Leader = Biker
{
AddPlayerClass(230,2317.3718,-1650.7227,14.2248,186.4385,0,0,0,0,0,0); // Biker
SendClientMessage(playerid, 0xFFFFFFAA, "** Welcome {33CC33}SoD CO-Leader {FFFFFF}**");
}
if(listitem == 2)//Elder = Grove Street
{
AddPlayerClass(134,2511.5886,-1665.9419,13.5726,93.2240,0,0,0,0,0,0); // Groove St
SendClientMessage(playerid, 0xFFFFFFAA, "** Welcome {33CC33}SoD Elder {FFFFFF}**");
}
if(listitem == 3)//Guest = Grove Street
{
AddPlayerClass(111,2511.5886,-1665.9419,13.5726,93.2240,0,0,0,0,0,0); // Groove St
SendClientMessage(playerid, 0xFFFFFFAA, "** Welcome {33CC33}Guest {FFFFFF}**");
SendClientMessage(playerid, 0xFFFFFFAA, "** Enjoy your stay here **");
}
}
}
}
return 1;
}