14.08.2013, 07:00
Everytime I use one of my dialogs (not login/register) It does not give me what I want from the list items,how do I fix this?
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Error",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Player Data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"ViPLevel",0);
INI_WriteInt(File,"Money",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"AdminLevel",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
}
}
case DIALOG_LOGIN:
{
if(!response)
{
Kick(playerid);
ShowPlayerDialog(playerid,DIALOG_D_LOGIN, DIALOG_STYLE_MSGBOX,""COL_BLUE"***Kicked***",""COL_LIGHTBLUE"You have been Kicked because you decided not to Login","Ok","");
}
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_BLUE"Success!",""COL_LIGHTBLUE"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_BLUE"Login",""COL_LIGHTBLUE"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
switch( listitem )
{
case DIALOG_FSPBT:
{
if (!response)
{
SendClientMessage(playerid,COLOR_RED, "You declined the New Player Package!");
}
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_BLUE, "You got given Full Armour from the Free Package");
GameTextForPlayer(playerid,"~g~Full Armour",3000,6);
SetPlayerArmour(playerid, 100.0);
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_BLUE, "You got given $10,000 from the Free Package");
GameTextForPlayer(playerid,"~g~$10,000",3000,6);
GivePlayerMoney(playerid, 10000);
}
if(listitem == 2)
{
ResetPlayerWeapons(playerid);
SendClientMessage(playerid,COLOR_GREEN, "You got given Double Ammo from the Free Package");
GameTextForPlayer(playerid,"~g~Double Ammo",3000,6);
GivePlayerWeapon(playerid, 34, 160);
}
}
}
case DIALOG_FSPRT:
{
if (!response)
{
SendClientMessage(playerid,COLOR_RED, "You declined the New Player Package!");
}
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_GREEN, "You got given Full Armour from the Free Package");
GameTextForPlayer(playerid,"~g~Full Armour",3000,6);
SetPlayerArmour(playerid, 100.0);
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_GREEN, "You got given $10,000 from the Free Package");
GameTextForPlayer(playerid,"~g~$10,000",3000,6);
GivePlayerMoney(playerid, 10000);
}
if(listitem == 2)
{
ResetPlayerWeapons(playerid);
SendClientMessage(playerid,COLOR_GREEN, "You got given Double Ammo from the Free Package");
GameTextForPlayer(playerid,"~g~Double Ammo",3000,6);
GivePlayerWeapon(playerid, 34, 160);
}
}
}
case DIALOG_SHOP:
{
if ( !response ) return SendClientMessage(playerid,COLOR_RED, "You exited the Shop Menu!");
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) > 999)
{
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 34,80);
SendClientMessage(playerid,COLOR_GREEN, "You Have Bought 80 Shell's of Sniper Ammo");
}
else SendClientMessage(playerid,COLOR_RED, "ERROR: You Don't Have Enough Money To Buy A Sniper!");
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) > 499)
{
SetPlayerArmour(playerid,100.0);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid,COLOR_GREEN, "You Have Brought Full Armour");
}
else SendClientMessage(playerid,COLOR_RED, "ERROR: You Don't Have Enough Money To Buy Armour!");
return 1;
}
return 1;
}
return 1;
}
}
return 1;
}