Post: What's going on here?
07-14-2015, 06:19 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); This is really confusing me

For some reason, this works for what I'm trying to do

    level.itemPrice["Human"]["General"]["Health"] = 120;

    AddHealth(amount, status)
{
if (self.money >= level.itemPrice[status]["General"]["Health"])
{
self.addingHealth = true;
wait 0.01;
self.health += amount;
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self giveWeapon( "supplydrop_mp" );
self switchToWeapon( "supplydrop_mp" );
self.money -= level.itemPrice[status]["General"]["Health"];
self iPrintln("^5+50 Health ^7Purchased Successfully");
}
else
self SendError("MoreMoney");
}


but this won't work
    level.itemPrice["Human"]["Killstreaks"]["HUNT"] = 10;

    HUNT()
{

if (self.money >= level.itemPrice[Human]["Killstreaks"]["HUNT"])
{
self.addingHealth = true;
wait 0.01;
self.health += amount;
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self.money -= level.itemPrice[Human]["Killstreaks"]["HUNT"];
self giveWeapon( "missile_drone_mp" );
self switchToWeapon( "missile_drone_mp" );
self iPrintln("^5+50 Health ^7Purchased Successfully");
}
else
self SendError("MoreMoney");
}


Does anyone know what's going on here? What's the problem?

What I'm trying to do is make it so the killstreaks cost money to purchase

If you look, I took the add health code because I knew it worked, and just made it so it also gave you a killstreak. This worked fine when it was in General, Add Health

But when I tried to make a new sub menu, it doesn't work. I go to Killstreaks, RCXD or whatever I added, and it just gives it to me for free, as well as the health.

Does anyone know how to fix this? They're exactly the same, just in different parts of the menu, and for some reason they aren't working
(adsbygoogle = window.adsbygoogle || []).push({});
07-14-2015, 07:23 PM #2
HiddenHour
I defeated!
Originally posted by HorrifyHosts View Post
This is really confusing me

For some reason, this works for what I'm trying to do

    level.itemPrice["Human"]["General"]["Health"] = 120;

    AddHealth(amount, status)
{
if (self.money >= level.itemPrice[status]["General"]["Health"])
{
self.addingHealth = true;
wait 0.01;
self.health += amount;
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self giveWeapon( "supplydrop_mp" );
self switchToWeapon( "supplydrop_mp" );
self.money -= level.itemPrice[status]["General"]["Health"];
self iPrintln("^5+50 Health ^7Purchased Successfully");
}
else
self SendError("MoreMoney");
}


but this won't work
    level.itemPrice["Human"]["Killstreaks"]["HUNT"] = 10;

    HUNT()
{

if (self.money >= level.itemPrice[Human]["Killstreaks"]["HUNT"])
{
self.addingHealth = true;
wait 0.01;
self.health += amount;
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self.money -= level.itemPrice[Human]["Killstreaks"]["HUNT"];
self giveWeapon( "missile_drone_mp" );
self switchToWeapon( "missile_drone_mp" );
self iPrintln("^5+50 Health ^7Purchased Successfully");
}
else
self SendError("MoreMoney");
}


Does anyone know what's going on here? What's the problem?

What I'm trying to do is make it so the killstreaks cost money to purchase

If you look, I took the add health code because I knew it worked, and just made it so it also gave you a killstreak. This worked fine when it was in General, Add Health

But when I tried to make a new sub menu, it doesn't work. I go to Killstreaks, RCXD or whatever I added, and it just gives it to me for free, as well as the health.

Does anyone know how to fix this? They're exactly the same, just in different parts of the menu, and for some reason they aren't working


You need to set the amount. You also didn't add quotation marks on "Human" for your prices.
    HUNT()
{

if (self.money >= level.itemPrice["Human"]["Killstreaks"]["HUNT"])
{
self.money -= level.itemPrice["Human"]["Killstreaks"]["HUNT"];
self.addingHealth = true;
wait 0.01;
self.health += amount;//amountneeds to be set to something
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self giveWeapon( "missile_drone_mp" );
self switchToWeapon( "missile_drone_mp" );
self iPrintln("ayy lmao");
}
else
self SendError("MoreMoney");
}
07-14-2015, 08:20 PM #3
Originally posted by TheHiddenHour View Post
You need to set the amount. You also didn't add quotation marks on "Human" for your prices.
    HUNT()
{

if (self.money >= level.itemPrice["Human"]["Killstreaks"]["HUNT"])
{
self.money -= level.itemPrice["Human"]["Killstreaks"]["HUNT"];
self.addingHealth = true;
wait 0.01;
self.health += amount;//amountneeds to be set to something
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self giveWeapon( "missile_drone_mp" );
self switchToWeapon( "missile_drone_mp" );
self iPrintln("ayy lmao");
}
else
self SendError("MoreMoney");
}

Still doesn't seem to be working, I'm having the exact same problem I was having before
It gives the killstreak but doesn't take away money
07-14-2015, 08:43 PM #4
HiddenHour
I defeated!
Originally posted by HorrifyHosts View Post
Still doesn't seem to be working, I'm having the exact same problem I was having before
It gives the killstreak but doesn't take away money


Then I doubt it's the script. You might not be defining things correctly.
07-14-2015, 08:52 PM #5
Originally posted by TheHiddenHour View Post
Then I doubt it's the script. You might not be defining things correctly.


What exactly do you mean by defining things correctly?
Here's how I have the menu lay out
    self add_option("Killstreaks", "^7Health / ^5$" + level.itemPrice["Human"]["Killstreaks"]["HUNT"], ::HUNT, 50, "Human");

(50 is the amount of health it sets, that's how the addhealth script works)
    level.itemPrice["Human"]["Killstreaks"]["HUNT"] = 150;


I'm fairly certain I'm defining it correctly, otherwise it wouldn't be giving me the killstreak at all
07-14-2015, 11:05 PM #6
HiddenHour
I defeated!
Originally posted by HorrifyHosts View Post
What exactly do you mean by defining things correctly?
Here's how I have the menu lay out
    self add_option("Killstreaks", "^7Health / ^5$" + level.itemPrice["Human"]["Killstreaks"]["HUNT"], ::HUNT, 50, "Human");

(50 is the amount of health it sets, that's how the addhealth script works)
    level.itemPrice["Human"]["Killstreaks"]["HUNT"] = 150;


I'm fairly certain I'm defining it correctly, otherwise it wouldn't be giving me the killstreak at all

I'm fairly certain I'm defining it correctly, otherwise it wouldn't be giving me the killstreak at all :troll:
Set the price
    level.itemPrice["Human"]["Killstreaks"]["HUNT"] = 150;

Add it to the menu like this Beachington
    self add_option("Killstreaks", "^7Hunter Killer / ^5$" + level.itemPrice["Human"]["Killstreaks"]["HUNT"], ::HUNT);

Heres the script
    HUNT()
{

if (self.money >= level.itemPrice["Human"]["Killstreaks"]["HUNT"])
{
self.money -= level.itemPrice["Human"]["Killstreaks"]["HUNT"];
self.addingHealth = true;
wait 0.01;
self.health += amount;//amount needs to be set to a number
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
self thread MonitorHealth();
self giveWeapon( "missile_drone_mp" );
self switchToWeapon( "missile_drone_mp" );
self iPrintln("ayy lmao");
}
else
self SendError("MoreMoney");
}

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo