Marfi
Wiek: 18 Na forum: 2027 dni Posty: 13
Nick w MP: Marfi
Piwa : 8
Kod: --[[
Autor: DylemaT929
Zas?b stacje elektryczne na serwer EasternCity 1.0
Je?eli chcesz u?y? tego kodu prosz? ci? aby? mnie zapyta? o pozwolenie.
Nie szanuje os?b kt?re u?ywaj? sobie mojego kodu bez pytania
Pami?taj gdy korzystasz z zasobu mojego nale?y zostawi? notk? o autorze kodu!
]]
elektryczne = {
[527] = true,
[529] = true,
}
ladowanie_pojazdu = {}
function laduj_baterie()
local pojazd = getPedOccupiedVehicle(client)
if pojazd then
local zabierzhajs = 500000
if not elektryczne[getElementModel(pojazd)] then triggerClientEvent(client, "onClientAddNotification", client, "Tw?j pojazd nie jest elektryczny, aby go na?adowa?", "error" ) return end
if getPlayerMoney(source) < zabierzhajs then triggerClientEvent(client, "onClientAddNotification", client, "Nie sta? Ci? aby na?adowa? tesle", "error" ) return end
takePlayerMoney(source, zabierzhajs)
setElementData(pojazd, "ladowanie_baterii", true)
local informacja = getElementData(pojazd,"vehicle:desc") or ""
setElementFrozen(pojazd,true)
setVehicleLocked(pojazd,true)
setTimer(function()
setElementData(pojazd, "vehicle:fuel", 100)
setVehicleLocked(pojazd, false)
setElementFrozen(pojazd, false)
setElementData(pojazd, "ladowanie_baterii", false)
setElementData(pojazd, "vehicle:desc", informacja)
triggerClientEvent(client, "onClientAddNotification", client, "Rozpocz?to ?adowanie tesli kt?re potrwa 3 godziny!", "success" )
end, 60000*180, 1)
local time = getRealTime()
local hours = time.hour
local minutes = time.minute
local kiedy = string.format("%02d:%02d", hours, minutes)
removePedFromVehicle(client)
local x,y,z = getElementPosition(pojazd)
setElementPosition(client, x,y-1.25,z)
setElementData(pojazd, "vehicle:desc", "[?adownie Tesli]\nGracz "..getPlayerName(client).." ?aduje tesle.\nCzas rozpocz?cia ?adowania tesli: "..kiedy.."\n-------------------")
end
end
addEvent("Laduj", true)
addEventHandler("Laduj", root, laduj_baterie)
b??d z debug 3 WARNING: ec-stacje-elektryczne/serwer_stacja.lua [Server] is encoded in ANSI instead of UTF-8. Please convert your file to UTF-8.
Ostatnio zmieniony przez Wilq 2021-04-17, 10:13, w całości zmieniany 1 raz