×

• Marketplace
• #### Tools

×
• Create New...
• 0

# Private shop random

## Question

Hello, I would like to modify this function Set Polymorph (30000, true); to put a random VNUM between 10000 and 10100 how?

• Created

## Recommended Posts

• 0

C++ or LUA?

LUA: SetPolymorph(math.random(10000, 10100), true); OR SetPolymorph(number(10000, 10100), true);
C++: SetPolymorph(number(10000, 10100), true);

You can use the 2nd solution for both but there is a difference in LUA:
local var = number(1, 10);
local var2 = math.random(1, 10);
for i = 1, 10 do
chat(var);
chat(var2);
end -- for

will return a different output:
math.random will save the value in the variable, so "chat(var2)" will always return the same number.
while chat(var) will ALWAYS return a different number, cause the "number" function will always randomize the output, even if you save it in a variable, it doesn't save its value.

• 1

Premium International Lua Developer

My service topic: https://bit.ly/2UPly54

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

##### Link to comment
• 0
1 hour ago, NabbHackeR said:

C++ or LUA?

LUA: SetPolymorph(math.random(10000, 10100), true); OR SetPolymorph(number(10000, 10100), true);
C++: SetPolymorph(number(10000, 10100), true);

You can use the 2nd solution for both but there is a difference in LUA:
local var = number(1, 10);
local var2 = math.random(1, 10);
for i = 1, 10 do
chat(var);
chat(var2);
end -- for

will return a different output:
math.random will save the value in the variable, so "chat(var2)" will always return the same number.
while chat(var) will ALWAYS return a different number, cause the "number" function will always randomize the output, even if you save it in a variable, it doesn't save its value.

Nice functions.So this can be used in manny things...I want to make an quest so player with an special item can change his level random.With your function its easy.

##### Link to comment
• 0
11 hours ago, Thanatos said:

Nice functions.So this can be used in manny things...I want to make an quest so player with an special item can change his level random.With your function its easy.

yes

• 1

Premium International Lua Developer

My service topic: https://bit.ly/2UPly54

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

##### Link to comment
• 0
3 hours ago, NabbHackeR said:

Ohh,Thank you!

##### Link to comment
• 0
7 minutes ago, Thanatos said:

Ohh,Thank you!

yw!

Premium International Lua Developer

My service topic: https://bit.ly/2UPly54

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

• 0

ty !

## 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

• Read our Rules

1. 0

2. 177

3. 1

4. 14

5. 0
6. 59

7. 1

8. 177

9. 163