How this?? Dialog problem
#1

hi i created a dialog system and need help..i want wen player buy something then he recieve health..example... player health is less than 100 then he buy Coke then it add +15 to player health and i also have problem with getplayerinterior i want dialog to appear only in interior 10 but fail and is there way to make code much shorter for usage?....help me america!!!!??


pawn Код:
CMD:buy(playerid,params[])
{
    new listitems[] = "{FFFFFF}$12\t{55EE55}Candy\n{FFFFFF}$20\t{55EE55}Hotdog\n{FFFFFF}$15    \t{55EE55}Softdrink\n{FFFFFF}$25\t{55EE55}Coke\n{FFFFFF}$150\t{55EE55}Bubblegum";
    ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"List of Items",listitems,"Buy","Exit");
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{  
    if(dialogid == 2){
    if(response){
    if(listitem == 0){
    if(GetPlayerMoney(playerid) >= 12){
    GivePlayerMoney(playerid,-12);
    SendClientMessage(playerid, grey, "INFO: Bought a candy");}
    else{
    SendClientMessage(playerid, red, "Not enough money to buy this product");}
    }
    if(listitem == 1){
    if(GetPlayerMoney(playerid) >= 20){
    GivePlayerMoney(playerid,-20);
    SendClientMessage(playerid, grey, "INFO: Bought a hotdog");}
    else{
    SendClientMessage(playerid, red, "Not enough money to buy this product");}
    }
    if(listitem == 2){
    if(GetPlayerMoney(playerid) >= 15){
    GivePlayerMoney(playerid,-15);
    SendClientMessage(playerid, grey, "INFO: Bought Softdrink");}
    else{
    SendClientMessage(playerid, red, "Not enough money to buy this product");}
    }
    if(listitem == 3){
    if(GetPlayerMoney(playerid) >= 25){
    GivePlayerMoney(playerid,-25);
    SendClientMessage(playerid, grey, "INFO: Bought a Coke in Can");}
    else{
    SendClientMessage(playerid, red, "Not enough money to buy this beverage");}
    }
    if(listitem == 4){
    if(GetPlayerMoney(playerid) >= 150){
    GivePlayerMoney(playerid,-150);
    SendClientMessage(playerid, grey, "INFO: Bought a bubblegum");}
    else{
    SendClientMessage(playerid, red, "Not enough money to buy this product");}
    }
    }
    }
    return 1;
}
Reply


Messages In This Thread
How this?? Dialog problem - by Brian_McCarthy - 02.01.2011, 05:17
Re: How this?? Dialog problem - by JamesC - 02.01.2011, 05:36
Re: How this?? Dialog problem - by Brian_McCarthy - 02.01.2011, 10:16

Forum Jump:


Users browsing this thread: 1 Guest(s)