PDA

View Full Version : Need help with a dialog


Face9000
30/12/2011, 09:46 PM
Ok so,i made a class dialog that show everytime a player spawns.But there is a problem,when a dialogbox appear,if i press ESC,no option where selected from the dialog and i got normal cj skin.

How to fix this problem?

here is the dialog:

if(dialogid == 888)
{
if(response)
{
if(listitem == 0) // Assault
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 24, 75);
GivePlayerWeapon(playerid, 27, 50);
GivePlayerWeapon(playerid, 31, 120);
SetPlayerSkin(playerid, 124);
}
if(listitem == 1) // Demolition
{
if(GetPlayerScore(playerid) < 500)
{
SendClientMessage(playerid,0xFF0000AA,"You need 500 score for Demolition class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
return 0;
}
else if(GetPlayerScore(playerid) > 500)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 35, 5);
GivePlayerWeapon(playerid, 28, 150);
GivePlayerWeapon(playerid, 16, 10);
SetPlayerSkin(playerid, 179);
}
}
if(listitem == 2) // Expert
{
if(GetPlayerScore(playerid) < 1000)
{
SendClientMessage(playerid,0xFF0000AA,"You need 1000 score for Expert class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
return 0;
}
else if(GetPlayerScore(playerid) > 1500)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 26, 240);
GivePlayerWeapon(playerid, 24, 75);
GivePlayerWeapon(playerid, 17, 20);
GivePlayerWeapon(playerid, 37, 150);
SetPlayerSkin(playerid, 272);
}
}
if(listitem == 3) // Sniper
{
if(GetPlayerScore(playerid) < 100)
{
SendClientMessage(playerid,0xFF0000AA,"You need 100 score for Sniper class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
return 0;
}
else if(GetPlayerScore(playerid) > 100)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 34, 200);
GivePlayerWeapon(playerid, 16, 20);
SetPlayerSkin(playerid, 183);
}
}
if(listitem == 4) // Damager
{
if(GetPlayerScore(playerid) < 100)
{
SendClientMessage(playerid,0xFF0000AA,"You need 5000 score for Damager class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
return 0;
}
else if(GetPlayerScore(playerid) > 5000)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 35, 100);
SetPlayerSkin(playerid, 33);
}
}
}
return 1;
}

OnPlayerSpawn:

ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");

Thanks.

AstonDA-G
30/12/2011, 09:48 PM
Im not gonna copy the code, but try after the if(response) close bracket, put return 0;

if(response)
{
//Listitems and stuff
}
return 0;
Hope I helped (somewhat) :)

Face9000
30/12/2011, 09:56 PM
Emh nope...not helped :|

AstonDA-G
30/12/2011, 09:58 PM
Well my last try to make use of myself, Instead of if(response) { }
My dialogs all have this;

if(dialogid == 1337) {
if(!response) return 0; //I have this
if(listitem == 0) { //else carry on to listitems
SendClientMessageToAll(-1, "TROLL");
}
}

Seems to work for me, else i'm sorry for wasting time :S

Face9000
30/12/2011, 10:04 PM
Nope,i can still press ESC and get the CJ Skin :|

AstonDA-G
30/12/2011, 10:07 PM
Sorry, I think I misread.
Maybe you should TogglePlayerSpectating or something until the player has chosen one of the listitems. Maybe don't include the if(response). If he presses esc then, it will just choose whichever item is selected.

AustinJ
30/12/2011, 10:13 PM
Try This
if(dialogid == 888)
{
if(response)
{
if(listitem == 0) // Assault
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 24, 75);
GivePlayerWeapon(playerid, 27, 50);
GivePlayerWeapon(playerid, 31, 120);
SetPlayerSkin(playerid, 124);
}
if(listitem == 1) // Demolition
{
if(GetPlayerScore(playerid) < 500)
{
SendClientMessage(playerid,0xFF0000AA,"You need 500 score for Demolition class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
}
else if(GetPlayerScore(playerid) > 500)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 35, 5);
GivePlayerWeapon(playerid, 28, 150);
GivePlayerWeapon(playerid, 16, 10);
SetPlayerSkin(playerid, 179);
}
}
if(listitem == 2) // Expert
{
if(GetPlayerScore(playerid) < 1000)
{
SendClientMessage(playerid,0xFF0000AA,"You need 1000 score for Expert class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
}
else if(GetPlayerScore(playerid) > 1500)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 26, 240);
GivePlayerWeapon(playerid, 24, 75);
GivePlayerWeapon(playerid, 17, 20);
GivePlayerWeapon(playerid, 37, 150);
SetPlayerSkin(playerid, 272);
}
}
if(listitem == 3) // Sniper
{
if(GetPlayerScore(playerid) < 100)
{
SendClientMessage(playerid,0xFF0000AA,"You need 100 score for Sniper class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
}
else if(GetPlayerScore(playerid) > 100)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 34, 200);
GivePlayerWeapon(playerid, 16, 20);
SetPlayerSkin(playerid, 183);
}
}
if(listitem == 4) // Damager
{
if(GetPlayerScore(playerid) < 100)
{
SendClientMessage(playerid,0xFF0000AA,"You need 5000 score for Damager class.");
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
}
else if(GetPlayerScore(playerid) > 5000)
{
SetPlayerArmour(playerid, 90.0);
GivePlayerWeapon(playerid, 35, 100);
SetPlayerSkin(playerid, 33);
}
}
}
else
{
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
}
}

Face9000
30/12/2011, 10:23 PM
Thank you! It's working now!