How do you use the modulus in amxx if there is one
The modulus I know in C and C++ is '%', so I was wondering how it is used in amxx if it is even in it. Cause it doesn't work for me.
Example code: Code:
if(16 % 2 == 0) |
Re: How do you use the modulus in amxx if there is one
There's no reason that shouldn't work.
|
Re: How do you use the modulus in amxx if there is one
hmm okay well ill go over my code again and check my variables and try with just putting numbers like i put there
|
Re: How do you use the modulus in amxx if there is one
hmm when i try just numbers, trying that one actually it gives my this
Code:
Warning: Redundant test: constant expression is non-zero on line 59 |
Re: How do you use the modulus in amxx if there is one
Show me the line where the error is.
|
Re: How do you use the modulus in amxx if there is one
figured out the problem I think, first is i got that warning becuase it needs a variable or it will tell me its dumb to do something like that. Then the first time when it didnt work was because modulus cant work if the number before the modulus is smaller. I think from running tests.
However I also get this whenever I do modulus (%) or division (/). First it will tell me to put debug at the end of my plugin in plugins.ini. When I do that it tells me this on the line where I use modulus or division Code:
L 08/17/2008 - 01:31:50: [AMXX] Run time error 11: divide |
Re: How do you use the modulus in amxx if there is one
Exolent[jNr]: if(16 % 2 == 0)
|
Re: How do you use the modulus in amxx if there is one
Show me the full code that you used.
|
Re: How do you use the modulus in amxx if there is one
The Pawn compiler is being uncharacteristically intelligent. 16 % 2 will obviously always equal 0. The warning is telling you that your code contains a calculation that will always have the same answer and so it is redundant. You can safely ignore that warning.
|
Re: How do you use the modulus in amxx if there is one
kk thanks thats what I thought, that example was actually just there because I use using it as an example my actual program is using variables, but I always get a division error ingame when it is debugging, I get this when I use division or modulus.
|
| All times are GMT -4. The time now is 03:09. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.