12.06.2014, 07:10
(
Последний раз редактировалось tommzy09; 12.06.2014 в 08:34.
)
i'm trying to get multiple dialogs to work but only the first dialog works perfect,
as for the second dialog, it shows the dialog options but once you select an option, it does nothing.
My first dialog is a weapon shop which works perfect, but the second dialog is a vehicle repair shop which doesn't work at all.
All my dialogs are done as checkpoints.
here's snippets of my code
Under Includes
Under OnPplayerEnterDynamicCP
now the main script itself
whats gone wrong? i get no compile errors but it just doesnt repair or add nos to the vehicle.
as for the second dialog, it shows the dialog options but once you select an option, it does nothing.
My first dialog is a weapon shop which works perfect, but the second dialog is a vehicle repair shop which doesn't work at all.
All my dialogs are done as checkpoints.
here's snippets of my code
Under Includes
Код:
#define SHOP_DIALOG 0 #define PETROL_DIALOG 1
Код:
if(checkpointid == Checkpoint[3]) // Petrol Dialog Idlewood { ShowPlayerDialog(playerid, PETROL_DIALOG, DIALOG_STYLE_LIST, "Repair Menu", "Repair Vehicle\nAdd Nitrous", "Select", "Exit");//Show them the dialog. }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog. { if(!response) return SendClientMessage(playerid, -1, "You have left the Weapon Shop.");//If they click "Exit" they have left the dialog(Shop). switch(listitem) { case 0://Baseball Bat { if(GetPlayerMoney(playerid) >= 100)//If they have more or equal to the price. { GivePlayerMoney(playerid, -100);//Take the cost. GivePlayerWeapon(playerid, 5, 1);//Give them the weapon/ammo. SendClientMessage(playerid, -1, "Baseball Bat purchased.");//And let them know they just purchased a weapon. return 1;//Tell pawno to stop processing now. } else//Else the dont have enough money to cover the purchase. { SendClientMessage(playerid, -1, "You dont have enough money to purchase this weapon.");//Tell them. return 1;//Tell pawno to stop processing now. } } case 1://Sawn-Off { if(GetPlayerMoney(playerid) >= 2000)//If they have more or equal to the price. { GivePlayerMoney(playerid, -2000);//Take the cost. GivePlayerWeapon(playerid, 26, 20);//Give them the weapon/ammo. SendClientMessage(playerid, -1, "Sawn-Off Shotgun purchased.");//And let them know they just purchased a weapon. return 1;//Tell pawno to stop processing now. } else//Else the dont have enough money to cover the purchase. { SendClientMessage(playerid, -1, "You dont have enough money to purchase this weapon.");//Tell them. return 1;//Tell pawno to stop processing now. } } case 2://Combat Shotgun { if(GetPlayerMoney(playerid) >= 1000)//If they have more or equal to the price. { GivePlayerMoney(playerid, -1000);//Take the cost. GivePlayerWeapon(playerid, 27, 20);//Give them the weapon/ammo. SendClientMessage(playerid, -1, "Combat Shotgun purchased.");//And let them know they just purchased a weapon. return 1;//Tell pawno to stop processing now. } else//Else the dont have enough money to cover the purchase. { SendClientMessage(playerid, -1, "You dont have enough money to purchase this weapon.");//Tell them. return 1;//Tell pawno to stop processing now. } } case 3://M4 { if(GetPlayerMoney(playerid) >= 2000)//If they have more or equal to the price. { GivePlayerMoney(playerid, -2000);//Take the cost. GivePlayerWeapon(playerid, 31, 100);//Give them the weapon/ammo. SendClientMessage(playerid, -1, "M4 purchased.");//And let them know they just purchased a weapon. return 1;//Tell pawno to stop processing now. } else//Else the dont have enough money to cover the purchase. { SendClientMessage(playerid, -1, "You dont have enough money to purchase this weapon.");//Tell them. return 1;//Tell pawno to stop processing now. } } } if(dialogid == PETROL_DIALOG)//If the dialog responded to is our Weapon Shop dialog. { if(!response) return SendClientMessage(playerid, -1, "You have exited the Repair Menu.");//If they click "Exit" they have left the dialog(Shop). switch(listitem) { case 0://Vehicle Repair { if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { RepairVehicle(GetPlayerVehicleID(playerid)); SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been repaired!");//And let them know they just purchased a weapon. return 1;//Tell pawno to stop processing now. } else { SendClientMessage(playerid,0xff0000ff,"You must be in a Vehicle!"); return 1; } } case 1://Nitro { { if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { AddVehicleComponent(GetPlayerVehicleID(playerid),1010); SendClientMessage(playerid, 0xFFFFFFFF, "Nitrous Added!"); return 1;//Tell pawno to stop processing now. } else { SendClientMessage(playerid,0xff0000ff,"You must be in a Vehicle!"); return 1; } } } } } } return 0; }