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.
getPlayerStorageValue(uid, key)
doPlayerSetStorageValue(uid, key, newValue)
setPlayerStorageValue(uid, key, newValue) -- //compats version
getGlobalStorageValue(valueid)
setGlobalStorageValue(key, newValue)
this one works buts only for 1 player not for the server.Combination of globalstorage for the event, and playerstorage to confirm they are in the event.
LUA:getPlayerStorageValue(uid, key) doPlayerSetStorageValue(uid, key, newValue) setPlayerStorageValue(uid, key, newValue) -- //compats version getGlobalStorageValue(valueid) setGlobalStorageValue(key, newValue)
if getPlayerStorageValue(cid,jailedstoragevalue_time) <= 0 then
if getPlayerStorageValue(uid, jailedstoragevalue_time) <= 0 then
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.
--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