Divide with zero - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Divide with zero (
/showthread.php?tid=572790)
Divide with zero -
vannesenn - 01.05.2015
Hi guys,
I'm makeing some stats for business system and I have a little bit BIG problem, some arrays will be zero few days(maybe more) in new month(stats are splited in months) but computer can't divide with zero. So, is any way that exit from dividing be 0 if is divider 0? It's help me a lot because now(with this stupid math) I must split that code(format function) on whole bench of ugly checks... Thanks a lot guys
Re: Divide with zero -
arlindi - 01.05.2015
Soo you are try to set some arrays to 0 after some days or moths ?
I thing use Unix Timestamp
Click
Here For the tutorial
It will help
NOTE: if i understand you wrong please explain mee it again
Thank you
Re: Divide with zero -
vannesenn - 01.05.2015
No, I found way to do that...
Код:
stock _HRP_Divide(Float:_dividend, Float:_divider)
{
if(_divider == 0.00) return (false);
return (_dividend / _divider);
}
I hope you understand know on what I thought.. Thanks, I solved the problem
Re: Divide with zero -
arlindi - 01.05.2015
Good Job i was thing you was need to re-create it