How this?? Dialog problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How this?? Dialog problem (
/showthread.php?tid=205714)
How this?? Dialog problem -
Brian_McCarthy - 02.01.2011
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;
}
Re: How this?? Dialog problem -
JamesC - 02.01.2011
pawn Код:
stock GivePlayerHealth( playerid, Float: health )
{
new Float: curHealth, Float: totHealth;
GetPlayerHealth( playerid, curHealth );
totHealth = health + curHealth;
if( totHealth > 100.0 )
{
SetPlayerHealth( playerid, 100.0 );
}
else
{
SetPlayerHealth( playerid, totHealth );
}
return 1;
}
pawn Код:
if( GetPlayerInterior( playerid ) == 10 )
pawn Код:
switch( listitem )
{
case 0: {
}
case 1: {
}
}
Re: How this?? Dialog problem -
Brian_McCarthy - 02.01.2011
thank you america

but wait where to put this??
pawn Код:
if( GetPlayerInterior( playerid ) == 10 )
pawn Код:
switch( listitem ){ case 0: { } case 1: { }}
can you put whole code?? :S