if(dialogid == [dialog id])
{
if(response)
{
//do things
ShowPlayerDialog(playerid, [dialog id], [dialog style]..... -> and more)
}
}
|
Код:
if(dialogid == [dialog id])
{
if(response)
{
//do things
ShowPlayerDialog(playerid, [dialog id], [dialog style]..... -> and more)
}
}
|
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/shop", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "WoF - Weapon Shop",
"Pistol {FF8000}2000$\n\
Silenced Pistol {FF8000}3000$\n\
Desert Eagle {FF8000}4500$\n\
Shotgun {FF8000}3000$\n\
Sawnn-off Shotgun {FF8000}7000$\n\
Combat Shotgun {FF8000}6500$\n\
MP5 {FF8000}4000$\n\
Tec-9 {FF8000}5000$\n\
AK-47 {FF8000}6000$\n\
M4 {FF8000}6500$\n\
Armour {FF8000}12000$\n\
Health {FF8000}10000$\n\
Grenade {FF8000}5000$",
"Buy","Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid ==2 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "WoF - Weapon Shop",
"Pistol {FF8000}2000$\n\
Silenced Pistol {FF8000}3000$\n\
Desert Eagle {FF8000}4500$\n\
Shotgun {FF8000}3000$\n\
Sawnn-off Shotgun {FF8000}7000$\n\
Combat Shotgun {FF8000}6500$\n\
MP5 {FF8000}4000$\n\
Tec-9 {FF8000}5000$\n\
AK-47 {FF8000}6000$\n\
M4 {FF8000}6500$\n\
Armour {FF8000}12000$\n\
Health {FF8000}10000$\n\
Grenade {FF8000}5000$",
"Buy","Cancel");
}
}
}
if(dialogid == 1 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, COLOR_RED, "{FF0000}You don't have enough cash.");
GivePlayerMoney(playerid, -2000);
GivePlayerWeapon(playerid, 22, 200); return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have purchased {FFFFFF}Pistol!");
}
case 1:.
...
...
...
{
|
Please , i want the dialog to remain as it is after buying a weap or double clicking an option!
|
WeaponDialog(playerid)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "WoF - Weapon Shop",
"Pistol {FF8000}2000$\n\
Silenced Pistol {FF8000}3000$\n\
Desert Eagle {FF8000}4500$\n\
Shotgun {FF8000}3000$\n\
Sawnn-off Shotgun {FF8000}7000$\n\
Combat Shotgun {FF8000}6500$\n\
MP5 {FF8000}4000$\n\
Tec-9 {FF8000}5000$\n\
AK-47 {FF8000}6000$\n\
M4 {FF8000}6500$\n\
Armour {FF8000}12000$\n\
Health {FF8000}10000$\n\
Grenade {FF8000}5000$",
"Buy","Cancel");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/shop", cmdtext, true, 10) == 0)
{
WeaponDialog(playerid);
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid ==2 && response)
{
switch(listitem)
{
case 0:
{
WeaponDialog(playerid);
}
}
}
if(dialogid == 1 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, COLOR_RED, "{FF0000}You don't have enough cash.");
GivePlayerMoney(playerid, -2000);
GivePlayerWeapon(playerid, 22, 200); return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have purchased {FFFFFF}Pistol!");
WeaponDialog(playerid);
}
case 1:.
{
//The action goes here
WeaponDialog(playerid);
}
|
I recommend you to do this for showing the dialog:
Код:
WeaponDialog(playerid)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "WoF - Weapon Shop",
"Pistol {FF8000}2000$\n\
Silenced Pistol {FF8000}3000$\n\
Desert Eagle {FF8000}4500$\n\
Shotgun {FF8000}3000$\n\
Sawnn-off Shotgun {FF8000}7000$\n\
Combat Shotgun {FF8000}6500$\n\
MP5 {FF8000}4000$\n\
Tec-9 {FF8000}5000$\n\
AK-47 {FF8000}6000$\n\
M4 {FF8000}6500$\n\
Armour {FF8000}12000$\n\
Health {FF8000}10000$\n\
Grenade {FF8000}5000$",
"Buy","Cancel");
return 1;
}
And in your command you can do this: Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/shop", cmdtext, true, 10) == 0)
{
WeaponDialog(playerid);
}
return 0;
}
And for the dialog response: Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid ==2 && response)
{
switch(listitem)
{
case 0:
{
WeaponDialog(playerid);
}
}
}
if(dialogid == 1 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, COLOR_RED, "{FF0000}You don't have enough cash.");
GivePlayerMoney(playerid, -2000);
GivePlayerWeapon(playerid, 22, 200); return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have purchased {FFFFFF}Pistol!");
WeaponDialog(playerid);
}
case 1:.
{
//The action goes here
WeaponDialog(playerid);
}
![]() |
Someone please help me out 
|
Well i tried it but it didn't work. I also tried without making it [ WeaponDialog(playerid); ]
Both didn't work. I understood that when we add that line in dialog response, it gives the player a weapon, it also gives him the dialog back. Thats what supposed to come if we add ShowPlayerDialog to the cases. But I don't know why it isn't working in mine. Someone please help me out ![]() Rohit |