Author Topic: My script is having issues.  (Read 312 times)

***SOLVED***

Code: [Select]
function servercmddisablewhisper(%client)
{
if(%client.isAdmin)
{
if($whisenabled = 0)
{
messageclient(%client, '',"Whispering is already disabled!");
}

else
{
messageall('',"Whispering is now disabled.");
$whisenabled = 0;
}
}
}

function servercmdenablewhisper(%client)
{
if(%client.isAdmin)
{
if($whisenabled = 1)
{
messageclient(%client, '',"Whispering is already enabled!");
}

else
{
messageall('',"Whispering is now enabled.");
$whisenabled = 1;
}
}
}

When I type /whisenabled it tells me it already is enabled. When I type /whisdisabled it tells me it disables it but actually does not. When I type /whisdisabled again it still says it disabled it, when it should have said: Whispering is already disabled. I cannot figure out the problem. Please help.
« Last Edit: November 02, 2009, 09:02:22 PM by Deriboy »

You need to use == for numerical comparisons; what you're doing isn't "if whisenabled is equal to 1", but instead "if whisenabled is not 0 after we set it to 1" (which will obviously never be false).