Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
if getGlobalStorageValue(45001) <= 0 then
-- starting event
setGlobalStorageValue(45001, 1)
elseif getGlobalStorageValue(45001) == 1 then
-- joining existing event
end
setPlayerStorageValue(cid, 45001, 1) -- note that global and player storages are separate, so they can share the same key and not interfere with each other.
if getGlobalStorageValue(45001) <= 0 then
-- starting event
setGlobalStorageValue(45001, 1)
elseif getGlobalStorageValue(45001) == 1 then
-- joining existing event
end
setPlayerStorageValue(cid, 45001, 1) -- note that global and player storages are separate, so they can share the same key and not interfere with each other.
Just use the example that Xikini gave
BUUT, I have a tip: you can use modulus operator to limit the amount of players in the same room.
Yea yea modulus operator, but don't be scared it's quite simple (I'll do it in pseudocode so please don't paste it into your script):
Code:
--this code should be placed where you handle the player join
maxPlayersInOneEvent = 10
amountOfPlayers = 0
globalStorage = 45001
setGlobalStorageValue(globalStorage, amountOfOtherPlayers)
if((getGlobalStorage(globalStorage)+ 1) % maxPlayersInOneEvent ~= 0) then
setGlobalStorageValue(globalStorage, amountOfPlayers)
amountOfPlayers = amountOfPlayers + 1
end
With the ideia of the code above (obvsly it's a sample and I haven't tested it) you can limit the quantity of players joining the same globalEvent.
With almost no change you can also make a new globalEvent when it reaches the max players amount and create dynamically rooms by-player-demand.