Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-01-21, 12:14


dida102

LUA To moja Pasja






Wiek: 25
Na forum: 3612 dni
Posty: 86
Nick w MP: Remi

Piwa: 642

Respekt: 20

Ostrzeżeń: 100%
Siema Mam Paczke Your Adwenture I nie Mg Da? se premium pisze /dajvipa Remi 1 I nie daje A dm Nie Moge szuszark? ruszy? Dam kodzik
- Przy kazdym wejsciu i wyjsciu ustawia maksymalna liczbe slotow na ilosc aktualnych graczy + 10% z maksymalnej ilosci slotow, zrobione przez Bone

function dynamiczne()
local maks_graczy getServerConfigSetting "maxplayers" )
local teraz_graczy #getElementsByType( "player" )
local nowe math.ceilteraz_graczy + (tonumber(maks_graczy) * 0.2) )
if tonumber(nowe) < tonumber(maks_graczythen
setMaxPlayers(nowe)
else
setMaxPlayers(tonumber(maks_graczy))
end
end

addEventHandler("onPlayerQuit",root,dynamiczne)
addEventHandler("onPlayerJoin",root,dynamiczne)

--[[addEventHandler("onPlayerConnect"getRootElement(), function (nickipusernameserial)
    local q exports.rpg_mysql:mysql_query("SELECT * FROM rpg_serials WHERE serial=?"serial)
    if #q < 1 then
        cancelEvent(true"Nie jeste? zautoryzowany do wej?cia na ten serwer !") 
    end
end)--]]

addEvent("core:spawnPlayer"true)
addEventHandler("core:spawnPlayer"root, function()
    local pos=getElementData(source,"player:spawn")
    if not pos then return end
    fadeCamera(sourcetrue)
    spawnPlayer(sourcepos[1], pos[2], pos[3])
    setCameraTarget(source,source)
    toggleControl(source,"fire"false)
    toggleControl(source,"aim_weapon"false)
    local load=loadPlayerData(source)
    if load then outputChatBox("* Pomy?lnie wczytano Twoje dane, ?yczymy mi?ej gry.",sourceend
    setElementData(source,'HS_accountName',getPlayerName(source));
    setElementData(source,"player:online",0)
    if getElementData(source,"player:premium"then 
        local queryA=string.format("SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1"getElementData(source,"player:uid"))
        local resultA=exports["ogrpg-db"]:dbSet(queryA)
        if (queryAthen
            --outputChatBox("* Konto premium wa?ne do " ..queryA["premiumdate"], source)
            outputChatBox("* Posiadasz aktywne konto premium do " .. queryA["premiumdate"] .. "."source2552000)
        end
        local v2=exports['ogrpg-db']:dbGet('SELECT * FROM ogrpg_users WHERE premium=?')
        for ile,_ in ipairs(v2) do
            ilosc ile
        end
        outputChatBox("* Aktualnie posiadamy "..ilosc.." kont(a/o) ze statusem PREMIUM, dzi?kujemy za wsparcie!"client255255255)
    end
    triggerClientEvent(source,"core:blipyaut",root,source)
end)

setTimer(function()
    local players=getElementsByType('player')
    for _p in pairs(players) do
            if getElementData(p"player:online") and tonumber(getElementData(p"player:online")) > 60 then
                if getElementData(p"player:online") == 60 then
                    local hour getElementData(localPlayer,"player:hours") or 0
                    setElementData(localPlayer,"player:hours",hour+1)
                end 
                setElementData(p"player:online"0)
                if getElementData(p"player:premium"then
                triggerEvent("givePlayerMoney"p10000false)
                outputChatBox("* Premium: Otrzymujesz 10000 PLN za przegranie 1h na serwerze."p)
            end
        end
     end
end600000)

addEventHandler("onPlayerWasted"root, function()
    plr=source
    if getElementData(plr,"player:job"then
        triggerClientEvent(plr,"onFinish"rootplr)
        setElementData(plr,"player:job"false)
    end
    setTimer(function()
        local pos=getElementData(plr,"player:spawn")
        if not pos then return end
        fadeCamera(plrtrue)
        setElementInterior(plr,0)
        setElementDimension(plr,0)
        spawnPlayer(plrpos[1], pos[2], pos[3])
        setCameraTarget(plrplr)
        setElementModel(plrgetElementData(plr"player:skin"))
    end601)
end)

addEvent("giveSpray"true)
addEvent("takeSpray"true)
addEventHandler("giveSpray"root, function()
    giveWeapon source41200 )
end)

addEvent("givecamera"true)
addEventHandler("givecamera"root, function()
    giveWeapon source4399999999 )
end)

addEventHandler("takeSpray"root, function()
    takeWeapon source41)
end)

addCommandHandler("frr", function(playerSource )
    local pos=getElementData(playerSource ,"player:spawn")
    if not pos then return end
    fadeCamera(playerSource true)
    setElementInterior(playerSource ,0)
    setElementDimension(playerSource,0)
    setElementPosition(playerSource pos[1], pos[2], pos[3])
    setCameraTarget(playerSource,playerSource )
    setElementModel(playerSourcegetElementData(playerSource "player:skin"))
end)

addEventHandler("onPlayerConnect"root, function(playerNick)
    if string.find(playerNick"#") ~= nil or string.find(playerNick"?") ~= nil or string.find(playerNick"!") ~= nil then
        cancelEvent(true,"Tw?j nick zawiera jeden z niedozwolonych znak?w(#,?,!), zmie? go.")
    end
end)

addEventHandler('onPlayerConnect'root, function(playerNickplayerIPplayerUsernameplayerSerial)
    local result=exports['ogrpg-db']:dbGet('SELECT * FROM ogrpg_ban WHERE active=1 AND serial=? AND time>NOW() LIMIT 1;'playerSerial)
    if #result > 0 then
        cancelEvent(true,"Zosta?e?(a?) zbanowany(a) na tym serwerze!\nPow?d zbanowania:" .. result[1].reason.."\nCzas bana:"..result[1].time.."\nOd kary mo?esz zaapelowa? na mta-yblife.cba.pl")
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_ban WHERE type=? AND active=1 AND serial=?""ban"playerSerial)
    end
end)

addEventHandler("onPlayerJoin"root, function()
    outputChatBox("* Witaj "..getPlayerName(source).." na Polski Serwer RPG."source)
    outputChatBox("* Je?eli jeste? tu po raz pierwszy zajrzyj pod F1!",source)
    outputChatBox("* Znajdziesz tam szczeg??owy poradnik."source)
end)

 addCommandHandler("closehud", function(plr,cmd)
    setElementData(plr,"notshowhud",not getElementData(plr,"notshowhud"))
 end)


addEventHandler("onResourceStart"resourceRoot, function()
    setWaveHeight(2)
    setMinuteDuration(6000)
    setMapName("RPG**DYNAMICZNE SLOTY**")
    setGameType("RPG**DYNAMICZNE SLOTY**")
end)


addEventHandler("onPlayerChangeNick"root, function() cancelEvent() end)
addEventHandler("onResourceStart"root, function() 
local players=getElementsByType('player')
for _p in pairs(players) do
--bindKey(p"y""down""chatbox""global")
end
end)

setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicletrue)
        elseif getElementHealth(vehicle)>301 then
            if getVehicleController (vehiclethen
            setVehicleDamageProof(vehiclefalse)
            end
        end
     end
end5000)

setTimer(function()
  for i,v in ipairs(getElementsByType("player")) do
    if not getElementData(v,"player:spawn"then return end
    if isPedDead(vthen
        local pos=getElementData(v,"player:spawn")
        fadeCamera(vtrue)
        setElementInterior(v,0)
        setElementDimension(v,0)
        spawnPlayer(vpos[1], pos[2], pos[3])
        setCameraTarget(vplr)
        setElementModel(vgetElementData(plr"player:skin"))
    end
    if( getPlayerIdleTime(v) > then
    setElementData(v"player:afk"true)
    elseif ( getPlayerIdleTime(v) < then
    setElementData(v"player:afk"false)
    end    
  end
end100000)




--[[
Obsluga oswietlenia drogowego
@author Lukasz Biegaj <wielebny@bestplay.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
@license Dual GPLv2/MIT
]]--



setTrafficLightsLocked(true)

-- 3 1 0 4

local stany={3,4,0,1}

local stan=1

local stany_nocne={6,9,6,9}

function zmianaSwiatel()
    stan=stan+1
    if (stan>#stany) then stan=1 end

    local h,m=getTime()
    if (h>=23 or m<=6then
        setTrafficLightState(stany_nocne[stan])
        setTimer(zmianaSwiatel5001)
    else
        setTrafficLightState(stany[stan])
        setTimer(zmianaSwiatelstan%2==and 15000 or 20001)

    end

end


zmianaSwiatel()


Komentarz marcin778 dodany 2017-01-21, 12:20Używaj znaczniki [lua][/lua]
Ostatnio zmieniony przez marcin778 2017-01-21, 12:19, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-21, 15:17


nanKy







Wiek: 22
Na forum: 3866 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

Nie masz komendy na nadawanie premium znajduje si? ona w ogrpg-gui>s_pgui.lua

Postaw piwo autorowi tego posta
 

 
Tagi: premium
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » DM Premium Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku