а время можно как-то исправить?
Примерно так:
local function GetPlayTime(ply)
if not IsValid(ply) then return 0 end
local connectTime = ply:GetNWFloat("connectTime", 0)
local currentTime = os.time()
-- Возвращаем разницу между текущим временем и временем подключения игрока в секундах
return currentTime - connectTime
end
hook.Add("PlayerInitialSpawn", "RecordConnectTime", function(ply)
if IsValid(ply) then
ply:SetNWFloat("connectTime", os.time())
end
end)
local allowedpromo = true
hook.Add( "PlayerSay", "promocoderangelorgrp", function(ply, text, isComChat)
if !allowedpromo then return end
if text:lower() ~= "/rangelorgrp" then return end
if GetPlayTime(ply) < 3600 then
ply:ChatPrint("Вы не наиграли 1 час!")
return ""
end
if (ply:GetPData( "fundamentt") == nil) then
ply:SetPData( "fundamentt", os.time() )
ply:AddIGSFunds(500, "promocode rangelorgrp")
ply:ChatPrint("Вы успешно получили бонус 500 руб!")
else
ply:ChatPrint("Вы уже получали бонус!")
end
return ""
end)
Спасибо помог!
Пожалуйста