The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RemoveItem("tinderbox") not working!
ehovda321 Offline
Junior Member

Posts: 38
Threads: 22
Joined: Dec 2011
Reputation: 0
#1
RemoveItem("tinderbox") not working!

Here is my script -

Spoiler below!


void OnStart()
{
SetEntityPlayerInteractCallback("buy_a", "buy_a", false);
SetEntityPlayerInteractCallback("sell_a", "sell_a", false);
}

void buy_a(string &in asEntity)
{

if(GetGlobalVarInt("buy_a") == 0) // < --- STOCK \\
{
SetGlobalVarInt("buy_a", 0);
SetMessage("store", "out", 3);
}

if(GetGlobalVarInt("balance") < 3) // < --- BALANCE \\
{
SetMessage("store", "cannotafford", 3);
}

if(GetGlobalVarInt("buy_a") > 0) // < --- STOCK \\
{
if(GetGlobalVarInt("balance") > 2) // < --- BALANCE \\
{
t_count++;
GiveItemFromFile("tinderbox_"+(t_count), "tinderbox.ent");
PlayGuiSound("cash_register.ogg", 1);
AddGlobalVarInt("balance", -3);
AddGlobalVarInt("buy_a", -1);
AddGlobalVarInt("tinderbox_total", 1);
SetMessage("store", "bought_a", 2.5);
checkamount_buy();
checkbalance();
}
}

}

void sell_a(string &in asEntity) // < -- Player SELLS ONE TINDERBOX \\
{

if(GetGlobalVarInt("tinderbox_total") == 0)
{
SetMessage("store", "notenough", 3);
}

if(GetGlobalVarInt("tinderbox_total") > 0) // < --- YOUR AMOUNT \\
{

for(int z = 1; z < 251; z++)
{
RemoveItem("tinderbox_"+(z - 1));
}

for(int y = 0; y < GetGlobalVarInt("tinderbox_total"); y++)
{
RemoveItem("tinderbox");
}


t_count++;
GiveItemFromFile("tinderbox_"+(t_count), "tinderbox.ent");


PlayGuiSound("cash_register.ogg", 1);
AddGlobalVarInt("balance", 2);
AddGlobalVarInt("buy_a", 1);
AddGlobalVarInt("tinderbox_total", -1);
SetMessage("store", "sold_a", 2.5);
checkamount_sell();
checkbalance();

}
}





What's the problem? When I click the button for "sell_a", it will double the amount!?
(This post was last modified: 03-29-2013, 01:50 AM by ehovda321.)
03-29-2013, 01:50 AM
Find


Messages In This Thread
RemoveItem("tinderbox") not working! - by ehovda321 - 03-29-2013, 01:50 AM



Users browsing this thread: 1 Guest(s)