[Discussion] 0 dividing bug... - 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: [Discussion] 0 dividing bug... (
/showthread.php?tid=317171)
[Discussion] 0 dividing bug... -
InferNus` - 10.02.2012
Hello SA:MP scripters, I'm creating this thread as 'Discussion' for the following reason:
I'm scripting a new GameMode, And i bumped into this problem:
Zero(0) divide (/) Zero(0)
break;s or return 0;s the current brackets content and returns 0.
Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/test", true) == 0) // << The '0' doesn't seems to be connected to the bug.
{
new str[128];
new ZeroA = 0;
new ZeroB = 0;
format(str, sizeof(str), "Test: %i", ZeroA/ZeroB);
SendClientMessage(playerid, 0xFFFFFFFF, str);
return 1;
}
return 0;
}
Well after i tried something smiliar to that, I got the "SERVER: Unknown Command" - I fully checked that was the Problem.
Now, i want to ask you to try a code like that, and to see if it does returns Unknown Command.
Overall problem is that it doesn't returns 0;
It makes the command crashes / return the command as 0 (Undefined).
Please post your results here.
If you don't know don't post.
thanks, InferNus`
Re: [Discussion] 0 dividing bug... -
milanosie - 10.02.2012
You are trying to devide by 0?
If that is what your trying, Its impossible...
Deviding by 0 is like having 1 apple and u will have to cut it into 0 pieces... impossible
Re: [Discussion] 0 dividing bug... -
InferNus` - 10.02.2012
Don't teach me math, And it does possible, Everything you devide by 0, Will be:
Код:
Impossible = Unknown = Natural = Zero = 0 = -
More examples ?
by the way this is my 50th post :P
Re: [Discussion] 0 dividing bug... -
DRIFT_HUNTER - 10.02.2012
You cant divide
ANYTHING by 0
If you put that divide into main function in pawn you will get error in console
pawn Код:
[14:46:49] Script[gamemodes/new.amx]: Run time error 11: "Divide by zero"
Re: [Discussion] 0 dividing bug... -
InferNus` - 10.02.2012
Might be right, but this error need to be compiled as >> 0 <<
Re: [Discussion] 0 dividing bug... -
milanosie - 10.02.2012
dude, if you type it into a calculator it will give you ERROR
0 is not the awnser of 0/0
there is no awnser
Re: [Discussion] 0 dividing bug... -
milanosie - 10.02.2012
Replying on ******,
Yep, Deviding x by 0 is 0. but the additional Math rule is "if X = 0 then it wont work"
So if that is the case, the rule about 0/x = 0 & n/n = 0 wont work
Re: [Discussion] 0 dividing bug... -
KingHual - 10.02.2012
You can't divide by 0. Learn your maths. Solution: DON'T DIVIDE BY 0.
Re: [Discussion] 0 dividing bug... -
InferNus` - 10.02.2012
Again, I know math (Get it already), What i'm saying is, that if you'll divide 0 by 0, It should return 0 and not an Error, Only in PAWN scripting, to have one Error less.
So 0/0 = 0, And not the ERROR. only in pawn...
I'll repeat myself in the third time, in the same post:
Because it gives an error, maybe it should return 0.
And again, return 0. Once more: 0
Double time to 0 = 0
Last but not least:
Hope you did understand me, InferNus`
Re: [Discussion] 0 dividing bug... -
Vince - 10.02.2012
Quote:
Originally Posted by InferNus`
So 0/0 = 0, And not the ERROR. only in pawn...
|
Try it on the Windows calculator and see what happens ..