Okay, thank you. Now I want when I press the button that I can purchase something. When I press the button, the weapon won't get added into my inventory and my money will decrased by 15 and then increase by 15 again.
PHP Code:
//#CLIENTSIDE
function onActionbuy()
{
if(this.item == Jeep)
{
if(player.rupees>=15)
{
addweapon Jeep2;
player.rupees-=15;
Shop_MultiLine1.setText("Danke für den Einkauf");
}
else
{
Shop_MultiLine1.setText("Nich genug Geld");
}
}
}
function onPlayertouchsme() {
new GuiWindowCtrl("Shop_Window4") {
profile = GuiBlueWindowProfile;
clientrelative = true;
clientextent = "544,447";
visible = true;
canmove = true;
canresize = false;
canmaximize = false;
closequery = false;
destroyonhide = true;
text = "Willkommen im Waffenshop";
x = 29;
y = 115;
new GuiScrollCtrl("Shop_TextList1_Scroll") {
profile = GuiBlueScrollProfile;
height = 426;
hscrollbar = "alwaysOff";
vscrollbar = "dynamic";
width = 120;
x = 9;
y = 15;
new GuiTextListCtrl("Shop_TextList1") {
profile = GuiBlueTextListProfile;
height = 426;
horizsizing = "width";
width = 99;
clearrows();
addrow(0,"Jeep");
}
}
new GuiScrollCtrl("Shop_MultiLine1_Scroll") {
profile = GuiBlueScrollProfile;
height = 426;
hscrollbar = "dynamic";
vscrollbar = "dynamic";
width = 403;
x = 138;
y = 14;
new GuiMLTextCtrl("Shop_MultiLine1") {
profile = GuiBlueMLTextProfile;
height = 16;
horizsizing = "width";
text = "<center><h1>Willkommen im Waffenshop!</h1><br> Hier erhalten sie eine Vielzahl an Mitteln um Ihre Gegner auszulöschen</center>";
width = 378;
}
}
new GuiButtonCtrl("Shop_Button1") {
profile = GuiBlueButtonProfile;
text = "Kaufen";
width = 80;
x = 286;
y = 380;
}
}
}
function Shop_TextList1.onSelect( entryid, entrytext, entryindex ) {
switch ( entrytext ) {
case "Jeep":
this.item = "Jeep";
temp.description = "<center><h1>Bombe</h1><br> Sprenge deine Gegner in die Luft!</center> Preis: 15g";
break;
}
Shop_MultiLine1.setText( temp.description );
}
function Shop_Button1.onAction() {
{
triggeraction(x,y,"buy","buy");
}
// Button "Kaufen" has been pressed
}