14.09.2011, 12:52
I made a dialog box with list to get weapons when we type /buy..... and i hv costed those weapons with dollars... and when someone buys a weapon: think that John has $10, and a Desert Eagle cost $1000, and when john buys it the money goes minus.... i want if the player doesnt have enough money to buy that weapon, then a message comes u dont have enough cash to buy this weapon.... can u plz help me in it... i want help hw to do that... heres my current script:
plz help me ASAP!!
Код:
This is under the : public OnPlayerCommandText(playerid, cmdtext[]) if(strcmp(cmd, "/buy", true) == 0) { ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Buy the weapons that you want from here.", "Desert Eagle = $6000 \nCombat Shotgun = $14000 \nMP5 = $10000 \nAK-47 = $14000 \nM4 = $16000", "Select", "Close"); return 1; } This is under: public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) if(dialogid == 3) { if(response == 0) return SendClientMessage(playerid, COLOR_YELLOW, "You closed the '/buy' menu."); switch(listitem) { case 0:{ SendClientMessage(playerid, COLOR_YELLOW, "You have bought a Desert Eagle for $6000."); GivePlayerWeapon(playerid, 24, 40); GivePlayerMoney(playerid, -6000); } case 1:{ SendClientMessage(playerid, COLOR_YELLOW, "You have bought a Combat Shotgun for $14000."); GivePlayerWeapon(playerid, 27, 107); GivePlayerMoney(playerid, -14000); } case 2:{ SendClientMessage(playerid, COLOR_YELLOW, "You have bought a MP5 for $10000."); GivePlayerWeapon(playerid, 29, 230); GivePlayerMoney(playerid, -10000); } case 3:{ SendClientMessage(playerid, COLOR_YELLOW, "You have bought a AK-47 for $14000."); GivePlayerWeapon(playerid, 30, 460); GivePlayerMoney(playerid, -14000); } case 4:{ SendClientMessage(playerid, COLOR_YELLOW, "You have bought a M4 for $16000."); GivePlayerWeapon(playerid, 31, 460); GivePlayerMoney(playerid, -16000); } } }