Jump to content

Question about %


iMr.WiFi..!

Recommended Posts

Posted

hello , i have question about "%" on coding ..

I use it sometimes but i didn't understand Its usefulness .. anyone can explain me what is its usefulness ?

  • Haha 1

Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة

ليس عليك اسعاد الجميع ,
ولكن عليك بإن لا تؤذي أحداً 

=========
You do not have to make everyone happy,
But you should not hurt anyone

 

Want to contact with me?

 

Discord: JustCarry#2616 (Always there)
Skype: Live:JustCarry10 (Not always)

  • MTA Team
Posted

% is modulo. It gives you the remainder from a division

2 % 1 = 0

3 % 2 = 1

50 % 23 = 4

and so on

Posted
25 minutes ago, LopSided_ said:

% is modulo. It gives you the remainder from a division

2 % 1 = 0

3 % 2 = 1

50 % 23 = 4

and so on

i understand it before your comment, however thanks for helping .. 

Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة

ليس عليك اسعاد الجميع ,
ولكن عليك بإن لا تؤذي أحداً 

=========
You do not have to make everyone happy,
But you should not hurt anyone

 

Want to contact with me?

 

Discord: JustCarry#2616 (Always there)
Skype: Live:JustCarry10 (Not always)

  • Moderators
Posted

It is very useful for repeating (dx) animations.
 

local duration = 4000 -- ms

local progress = getTickCount() % duration / duration
-- progress 0 t/m 1

 

  • Like 3

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
10 hours ago, IIYAMA said:

It is very useful for repeating (dx) animations.
 


local duration = 4000 -- ms

local progress = getTickCount() % duration / duration
-- progress 0 t/m 1

 

Good example, wow ! 

Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة

ليس عليك اسعاد الجميع ,
ولكن عليك بإن لا تؤذي أحداً 

=========
You do not have to make everyone happy,
But you should not hurt anyone

 

Want to contact with me?

 

Discord: JustCarry#2616 (Always there)
Skype: Live:JustCarry10 (Not always)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...