#include <a_samp>
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define WEAPONS 2222
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ws", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 2222, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $50\nArmour - $100\n9mm - $275\nSilence Pistol - $310\nDesert Eagle - $450\nShotgun - $520\nSawn-Off Shotgun - $800\nCombat Shotgun - $845\nMicro SMG - $1000\nMP5 - $1200\nTec-9 - $3400\nAK-47 - $4000\nM4 - $4500\nCountry Rifle - $5000\nSniper Rifle - $5000", "Purchase", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2222)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, COLOR_RED, "You need $50. (/cashhelp)");
GivePlayerMoney(playerid, -50);
SetPlayerHealth(playerid, 100); //Health
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You need $100. (/cashhelp)");
GivePlayerMoney(playerid, -100);
SetPlayerArmour(playerid, 100); //Armour
}
if(listitem == 2)
{
if(GetPlayerMoney(playerid) < 275) return SendClientMessage(playerid, COLOR_RED, "You need $275. (/cashhelp)");
GivePlayerMoney(playerid, -275);
GivePlayerWeapon(playerid, 22, 1500); //9mm
}
if(listitem == 3)
{
if(GetPlayerMoney(playerid) < 310) return SendClientMessage(playerid, COLOR_RED, "You need $310. (/cashhelp)");
GivePlayerMoney(playerid, -310);
GivePlayerWeapon(playerid, 23, 1500); //Silence Pistol
}
if(listitem == 4)
{
if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, COLOR_RED, "You need $450. (/cashhelp)");
GivePlayerMoney(playerid, -450);
GivePlayerWeapon(playerid, 24, 1500); //Desert Eagle
}
if(listitem == 5)
{
if(GetPlayerMoney(playerid) < 520) return SendClientMessage(playerid, COLOR_RED, "You need $520. (/cashhelp)");
GivePlayerMoney(playerid, -520);
GivePlayerWeapon(playerid, 25, 1500); //Shotgun
}
if(listitem == 6)
{
if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, COLOR_RED, "You need $800. (/cashhelp)");
GivePlayerMoney(playerid, -800);
GivePlayerWeapon(playerid, 26, 1500); //Sawn-off
}
if(listitem == 7)
{
if(GetPlayerMoney(playerid) < 845) return SendClientMessage(playerid, COLOR_RED, "You need $845. (/cashhelp)");
GivePlayerMoney(playerid, -845);
GivePlayerWeapon(playerid, 27, 1500); //Combat Shotgun
}
if(listitem == 8)
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "You need $1000. (/cashhelp)");
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 28, 1500); //Micro SMG
}
if(listitem == 9)
{
if(GetPlayerMoney(playerid) < 1200) return SendClientMessage(playerid, COLOR_RED, "You need $1200. (/cashhelp)");
GivePlayerMoney(playerid, -1200);
GivePlayerWeapon(playerid, 29, 1500); //MP5
}
if(listitem == 10)
{
if(GetPlayerMoney(playerid) < 3400) return SendClientMessage(playerid, COLOR_RED, "You need $3400. (/cashhelp)");
GivePlayerMoney(playerid, -3400);
GivePlayerWeapon(playerid, 32, 1500); //Tec-9
}
if(listitem == 11)
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, COLOR_RED, "You need $4000. (/cashhelp)");
GivePlayerMoney(playerid, -4000);
GivePlayerWeapon(playerid, 30, 1500); //AK-47
}
if(listitem == 12)
{
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED, "You need $4500. (/cashhelp)");
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 31, 1500); //M4
}
if(listitem == 13)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 33, 1500); //Country Rifle
}
if(listitem == 14)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 34, 1500); //Sniper Rifle
}
else // Pressed ESC or clicked cancel
{
SendClientMessage(playerid, COLOR_LIME, "Weapon shop closed. (/ws)");
}
return 1;
}
return 1;
}
return 1;
}
Hi, when i type /ws it'll open the dialog but when clicking purchase nothing happens, also when clicking cancel it will not show a message (also when not enough money no message)
pawn Код:
|
if(listitem == 14)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 34, 1500); //Sniper Rifle
}
}else return SendClientMessage(playerid, COLOR_LIME, "Weapon shop closed. (/ws)");
}
#include <a_samp> #define COLOR_RED 0xAA3333AA #define COLOR_LIME 0x10F441AA public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/ws", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid, 2222, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $50\nArmour - $100\n9mm - $275\nSilence Pistol - $310\nDesert Eagle - $450\nShotgun - $520\nSawn-Off Shotgun - $800\nCombat Shotgun - $845\nMicro SMG - $1000\nMP5 - $1200\nTec-9 - $3400\nAK-47 - $4000\nM4 - $4500\nCountry Rifle - $5000\nSniper Rifle - $5000", "Purchase", "Cancel"); return 1; } return 0; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 2222) { if(response) { if(listitem == 0) { if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, COLOR_RED, "You need $50. (/cashhelp)"); SetPlayerHealth(playerid, 100); //Health GivePlayerMoney(playerid, -50); } if(listitem == 1) { if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You need $100. (/cashhelp)"); SetPlayerArmour(playerid, 100); //Armour GivePlayerMoney(playerid, -100); } if(listitem == 2) { if(GetPlayerMoney(playerid) < 275) return SendClientMessage(playerid, COLOR_RED, "You need $275. (/cashhelp)"); GivePlayerWeapon(playerid, 22, 1500); //9mm GivePlayerMoney(playerid, -275); } if(listitem == 3) { if(GetPlayerMoney(playerid) < 310) return SendClientMessage(playerid, COLOR_RED, "You need $310. (/cashhelp)"); GivePlayerWeapon(playerid, 23, 1500); //Silence Pistol GivePlayerMoney(playerid, -310); } if(listitem == 4) { if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, COLOR_RED, "You need $450. (/cashhelp)"); GivePlayerWeapon(playerid, 24, 1500); //Desert Eagle GivePlayerMoney(playerid, -450); } if(listitem == 5) { if(GetPlayerMoney(playerid) < 520) return SendClientMessage(playerid, COLOR_RED, "You need $520. (/cashhelp)"); GivePlayerWeapon(playerid, 25, 1500); //Shotgun GivePlayerMoney(playerid, -520); } if(listitem == 6) { if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, COLOR_RED, "You need $800. (/cashhelp)"); GivePlayerWeapon(playerid, 26, 1500); //Sawn-off GivePlayerMoney(playerid, -800); } if(listitem == 7) { if(GetPlayerMoney(playerid) < 845) return SendClientMessage(playerid, COLOR_RED, "You need $845. (/cashhelp)"); GivePlayerWeapon(playerid, 27, 1500); //Combat Shotgun GivePlayerMoney(playerid, -845); } if(listitem == 8) { if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "You need $1000. (/cashhelp)"); GivePlayerWeapon(playerid, 28, 1500); //Micro SMG GivePlayerMoney(playerid, -1000); } if(listitem == 9) { if(GetPlayerMoney(playerid) < 1200) return SendClientMessage(playerid, COLOR_RED, "You need $1200. (/cashhelp)"); GivePlayerWeapon(playerid, 29, 1500); //MP5 GivePlayerMoney(playerid, -1200); } if(listitem == 10) { if(GetPlayerMoney(playerid) < 3400) return SendClientMessage(playerid, COLOR_RED, "You need $3400. (/cashhelp)"); GivePlayerWeapon(playerid, 32, 1500); //Tec-9 GivePlayerMoney(playerid, -3400); } if(listitem == 11) { if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, COLOR_RED, "You need $4000. (/cashhelp)"); GivePlayerWeapon(playerid, 30, 1500); //AK-47 GivePlayerMoney(playerid, -4000); } if(listitem == 12) { if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED, "You need $4500. (/cashhelp)"); GivePlayerWeapon(playerid, 31, 1500); //M4 GivePlayerMoney(playerid, -4500); } if(listitem == 13) { if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)"); GivePlayerWeapon(playerid, 33, 1500); //Country Rifle GivePlayerMoney(playerid, -5000); } if(listitem == 14) { if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)"); GivePlayerWeapon(playerid, 34, 1500); //Sniper Rifle GivePlayerMoney(playerid, -5000); } else // Pressed ESC or clicked cancel { SendClientMessage(playerid, COLOR_LIME, "Weapon shop closed. (/ws)"); } return 1; } return 1; } return 1; }