mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2016
Posts: 2
N
Bowl of petunias
OP Offline
Bowl of petunias
N
Joined: Jul 2016
Posts: 2
Hello Mirc Community, I looked around everywhere but i cannot seem to find a fix

Here is the code

; Shooting game
on *:text:!click*:#: {
if ($0 != 4) || ($4 !isnum) {
if (%floodshoot) { return }
if ($($+(%,arty_C.,$nick),2)) msg $chan $nick $+ , Your gun is reloading please wait $duration(%arty_C. [ $+ [ $nick ] ])
elseif ($2 isnum 1-5000000000000000000000) {
var %shoot = $int($2)
if ($int($2) == $2) {
var %randshoot = $rand(1,100)
if ($readini(Points.ini,$+(#,.,$nick),Points) < %shoot) { msg $chan Sorry $nick but you do not have enough $readini(channelconfig/ $+ $($+(channelconfig.,$chan,.ini)),n,settings,points) }
if (%randshoot <= 60) {
writeini -n Points.ini $+(#,.,$nick) Points $calc($readini(Points.ini,$+(#,.,$nick),Points) - %shoot)
msg $chan $nick aims in carefully and clicks $3 the bullet lands beside him, Doing no damage (You lose) $nick now has $readini(Points.ini,$+(#,.,$nick),Points) $readini(channelconfig/ $+ $($+(channelconfig.,$chan,.ini)),n,settings,points) $+ .
}
elseif (%randshoot >= 60) {
writeini -n Points.ini $+(#,.,$nick) Points $calc($readini(Points.ini,$+(#,.,$nick),Points) + (%shoot * 2))
msg $chan $nick aims in carefully and clicks $3 the bullet lands, YOU HIT HIM DIRECTLY (You Win) $nick now has $readini(Points.ini,$+(#,.,$nick),Points) $readini(channelconfig/ $+ $($+(channelconfig.,$chan,.ini)),n,settings,points) $+ !
}
SET -ze %arty_C. $+ $nick 60
}
else msg $chan Whole numbers only, $nick
}
else msg $chan To shoot someone using $readini(channelconfig/ $+ $($+(channelconfig.,$chan,.ini)),n,settings,points) $+ , use the form "!click <amount> (user)" with whole numbers only.
}
}

Heres what it does
nukulargamer : !gamble 5
BOT : nukulargamer rolls a 71 and wins double their bet! nukulargamer now has 26570 Nukes!

Now here the glitch
nukulargamer : !points
BOT : nukulargamer has 26570 total Nukes
nukulargamer : !gamble 100000000
BOT : nukulargamer rolls a 20 and loses! nukulargamer now has -99973430 Nukes.

I been trying to make it so you cant *gamble/click* over the "nukes" you currently have

as you can see i had 26570 and i "gambled" 100000000 "nukes"

Joined: Jun 2015
Posts: 84
F
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
I didn't look at everything in the script, but with your problem maybe this will work.

This should go before the var %shoot = $int($2) line.

Code:
if ($2 > $readini(Points.ini,$+(#,.,$nick),Points)) { 
msg $chan $nick you cannot bet more points than you have. 
}


I also recommend making it where they can't gamble negative points as well, to rapidly inflate their point totals.

Something like this would work.
Code:
 if ($int($2) == $2 && $2 > 0) {


This will ensure that even if they lose that it won't add points instead.

Hope that what I have here helped.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Your mistake is in if-else usage:
Code:
if (not enough points) { something_1 }
if (%randshoot <= 60) { something_2 }

so both IFs will trigger if you dont have enough points and rolled 60+.


Dont give a fish - teach to fish!
Joined: Jul 2016
Posts: 2
N
Bowl of petunias
OP Offline
Bowl of petunias
N
Joined: Jul 2016
Posts: 2
Thank you, This fixes it!


Link Copied to Clipboard