Dialog Help
#1

Hey,

When I have two Dialog Boxes one is you do /duty and it brings up Tog Duty, Weapon Equip, and Change Skin.

When I go to Weapon Equip and select Armor, it brings me on duty or takes me off duty.
I check the code and it has SetPlayerArmor(playerid, 100);
Thats all there is.

Heres the code:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[256];
new sendername[MAX_PLAYER_NAME];
// We SHOULD use switch(dialogid) with cases, but we're only going to use one dialog in this tutorial.
if(dialogid == sapdduty && response) // If the dialogid is 1 (our dialog) and they pressed 'Select'
{
// We'll use the switch/cases now because we're going to process a few results, not just one. Remember, the first item in the list has id 0.
switch(listitem)
{
case 0:
{
if(OnDuty[playerid]==0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
SafeGivePlayerWeapon(playerid, 24, 300);
SafeGivePlayerWeapon(playerid, 41,500);
SafeGivePlayerWeapon(playerid, 3, 0);
SafeGivePlayerWeapon(playerid, 29,500);
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
SetPlayerColor(playerid,COLOR_BLUE);
OnDuty[playerid] = 1;
format(string, sizeof(string), "* %s pulls out some weapons and badge from their locker.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
else
{
GetPlayerName(playerid, sendername, sizeof(sendername));
SafeResetPlayerWeapons(playerid);
SetPlayerArmour(playerid, 0);
OnDuty[playerid] = 0;
SetPlayerColor(playerid,COLOR_WHITE);
format(string, sizeof(string), "* %s puts in some weapons and badge in their locker.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}

}
case 1:
{
ShowPlayerDialog(playerid, sapdew, DIALOG_STYLE_LIST, "SAPD Weapons", "Body Armour", "Select", "Cancel");
}
case 2:
{
if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
}
}
if(dialogid == sapdew && response) // If the dialogid is 1 (our dialog) and they pressed 'Select'
{
// We'll use the switch/cases now because we're going to process a few results, not just one. Remember, the first item in the list has id 0.
switch(listitem)
{
case 0:
{
SetPlayerArmour(playerid, 100);
}
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)