Jump to content

Dynamic Situations


Recommended Posts

Posted

Okay guys, hi there again ;)

I have some problems here, I dont know how to implement this.

So the mapper makes a map for the gamemode, the gamemode can receive 10 cars to spawn them.

THEN, I want to calculate the dynamic situation, I mean, when that gamemode start it will check players on.

1ºIF players on are < 4 then I want 2 cars.

2ºIF players on are > 4 and < 8 then I want 6 cars.

3ºIF players on are > 8 then I want 10 cars.

The cars is an example, could be, markers for teleport, spawns, flags..

I know that I can make this by simple conditions and in each one call a function.

But that would make a large code!! because on 3º condition, the function would have to had the cars of 1º,2º and 3º condition, you see?

And on 2º condition, the function would have to had the cars of 1º and 2º condition, you see guys?

I talk here about an example, a dynamic situation with 3 conditions. But look if there are more conditions..? each one would have a function, and would have function very long..

Wont cause lag problems? much code?

Is there a way to do this with less code? an optimized solution?

Thanks in advance, sorry about my bad english ;)

  • MTA Team
Posted

Very simple

function iif(a,b,c) 
if a then  
return b  
else return c  
end 
end 

then

  
spawnCars(iif(players<4, 2, iif(players>4 and players<8, 6, iif(players>8, 10, 10)))) 

Posted
Very simple
function iif(a,b,c) 
if a then  
return b  
else return c  
end 
end 

then

  
spawnCars(iif(players<4, 2, iif(players>4 and players<8, 6, iif(players>8, 10, 10)))) 

I think I get it, will try to make something like that .

Thanks both ;)

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