Hi, think of math.randomseed() like the starting poit of your randomness, the seed, in order to have unpredictable random numbers you have to provide a integer seed to this function and from now on in your script the random numbers will be generated from this seed, like:
This will give you the same results every single time the code is generated
for i = 1, 10 do
print(math.random());
end
While this will change every single time due to getRealTime().timestamp never returning the same number.
math.randomseed(getRealTime().timestamp);
for i = 1, 10 do
print(math.random());
end
Add a table with the interiors you don’t want to delete and do a check before like this
local table = { 600, 610, 679 } -- add here
addEventHandler("onResourceStart", resourceRoot, function()
for i=550, 20000 do
if not table[i] then
removeWorldModel(i, 10000, 0, 0, 0, 0)
setOcclusionsEnabled(false)
end
end
end)
I used to have a problem when I was running a server, I had no anti-spam and 2-3 guys started spamming the chat while 40 people where online and the server couldn't keep up and restarted a few times until I reallized I needed an anti-spam.
Is there a chance you might have a similar problem? Can you share some screenshots?
Greetings.
Hmm, I see it's a modified version of a DayZ GM I've once posted, normally upon registration all data are set to a default value, 100 for food and water and 1000 for health ? If they're not it means you have a problem with the registration function, may I take a look?
--server side
function insideCar(player) --define player here so we know whom used the commandhandler
local vehicle = getPedOccupiedVehicle(player) --is he in a car?
if vehicle then
outputChatBox("You're in a car", player) --serverside we need to specifie the player we output to, else we outpoot to root (all players)
else
outputChatBox("You're on foot", player)
end
end
addCommandHandler("check", insideCar)
-------------------------------------------------------------------------------------------------------------
--and for client you use it like that 'localPlayer' is a client only variable
function insideCar()
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
outputChatBox("You're in a car") --clientside outputChatBox outputs directlly to the client in question
else
outputChatBox("You're on foot")
end
end
addCommandHandler("check", insideCar)
Do you know the difference between client/server scripts?
getPlayerSerial() -to get the serial
https://wiki.multitheftauto.com/wiki/GetPlayerSerial
Ant to communicate with the UCP you can use, fetchRemote()
https://wiki.multitheftauto.com/wiki/FetchRemote
But what exactly you want to achieve? It might be easier with a MySQL database.