Version Number:0.51.3
________________________________________________________________________
Location
Virtua World
________________________________________________________________________
Description:
When using an if-else thing in a script, if the if condition is true, the script also executes the else part.
________________________________________________________________________
Steps to Replicate:
Code: Select all
//MMG settings
$kMMGBet = 100 //Amount of denari each player bets
$kMMGWin = 198 //Amount of denari the winning player receives
//The MMG script
Event( "&command", "InitMMG")
{
$gMMGPlayer = 0
}
Event( "&command", "MMG")
{
*msg %player% Welcome to Money Making game!
*msg %player% The current bet is $kMMGBet
*msg %player% To start, type &StartMMG.
}
Event( "&command", "StartMMG")
{
if ($gMMGPlayer == 0)
{
$gMMGPlayer = %player%
*msg %player% Waiting for another player.
*say %player% is now playing the MMG.
*say Type &StartMMG to join.
}
else
{
*say $gMMGPlayer
*grantcash %player% -$kMMGBet
*grantcash $gMMGPlayer -$kMMGBet
$gMMGWinner = Rand(2)
if ($gMMGWinner == 1) //Joining player wins
{
*say %player% wins $kMMGWin denari!
*grantcash %player% $kMMGWin
}
else
{
*say $gMMGPlayer wins $kMMGWin denari!
*grantcash $gMMGPlayer $kMMGWin
}
$gMMGPlayer = 0
}
}
After doing &StartMMG, it checks if $gMMGPlayer is 0 or not.
If it is, it does $gMMGPlayer = %player% (resulting in 0 )
If it isn't (i.e. somebody has already started), it starts the game.
However, it also starts the game when $gMMGPlayer = 0. It shouldn't.