28.07.2015, 07:33
Hey again
I am facing a problem with dialog response, I am making an Credits system and when I select an option on /cshop command it does nothing, here is the codes
Any idea on what is wrong?
I am facing a problem with dialog response, I am making an Credits system and when I select an option on /cshop command it does nothing, here is the codes
Код:
CMD:cshop(playerid, params[]) { ShowPlayerDialog(playerid, DIALOG_CSHOP, DIALOG_STYLE_LIST,"Credits Shop","Refill Health "orange"[2 Credits]\n"white"Refill Armour "orange"[5 Credits]","Choose","Cancel"); return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_CSHOP: { if(response) { switch(listitem) { case 0: { if(Data[playerid][pCredits] < 2) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits"); SetPlayerHealth(playerid, 100); Data[playerid][pCredits] -= 2; SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Health"); } case 1: { if(Data[playerid][pCredits] < 5) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits"); SetPlayerArmour(playerid, 100); Data[playerid][pCredits] -= 5; SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Armour"); } } } } } return 1; }