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

Wysłany: 2016-08-15, 13:57


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Witam, wie kto? mo?e jak zablokowa? przesy?anie pieni?dzy na to samo uid ( gdy np. 2 graczy jest na jednym koncie )

Kod na przesy?anie:

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function onPrivateMessage(plr, cmd, target, ...)
    if not target or not {...} then
        outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
        return
    end

    local text=table.concat({...}, ' ')
    local target=findPlayer(plr, target)
    if not target then
        outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
        return
    end

    outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
    outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true) 

      local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
      triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)

function zaplacPieniadze(plr, cmd, cel, value)
    if not(value or cel) then
    outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    local target = znajdzGracza(plr, cel)
    
    if not(target) then
    outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
    outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(target, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", target,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(target).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)

setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _, vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicle, true)
        elseif getElementHealth(vehicle)>301 then
            setVehicleDamageProof(vehicle, false)
        end
     end
end, 500, 0)


Oczywi?cie jest to kod z ogrpg ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 14:30


Xaar







Wiek: 26
Na forum: 5592 dni
Posty: 47
Nick w MP: PLWESOLYKOSTEK

Piwa: 82

Respekt: 60

daj kod ktory nadaje uid graczom (elementdate) i sprawdzaj czy uid nie pokrywa sie ze soba najlepiej byloby to zrobic tak


if elementdatanauid == elementdatanauid then
cancelEvent()
end


i podczepiasz pod funkcje zaplacPieniadze

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 14:57


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Nie dzia?a, zrobi?em co? takiego:

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function onPrivateMessage(plr, cmd, target, ...)
    if not target or not {...} then
        outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
        return
    end

    local text=table.concat({...}, ' ')
    local target=findPlayer(plr, target)
    if not target then
        outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
        return
    end

    outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
    outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true) 

      local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
      triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)

function zaplacPieniadze(plr, cmd, cel, value)
    if elementdatanauid == player:uid then
cancelEvent()
end

    if not(value or cel) then
    outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    local target = znajdzGracza(plr, cel)
    
    if not(target) then
    outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
    outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(target, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", target,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(target).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)

setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _, vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicle, true)
        elseif getElementHealth(vehicle)>301 then
            setVehicleDamageProof(vehicle, false)
        end
     end
end, 500, 0)


DB:

ERROR: Loading script failed: blablabla/ogrpg-core/cmd.lua:31: function arguments expected near 'then'

Dobrze? :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 15:30


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

if target == plr then return  outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 15:37


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Dalej nic.
DB3:
ogrpg-core/cmd.lua:31: attempt to call global 'znajdzGracza' ( a nil value)

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function onPrivateMessage(plr, cmd, target, ...)
    if not target or not {...} then
        outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
        return
    end

    local text=table.concat({...}, ' ')
    local target=findPlayer(plr, target)
    if not target then
        outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
        return
    end

    outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
    outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true) 

      local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
      triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)

function zaplacPieniadze(plr, cmd, cel, value)
   local target = znajdzGracza(plr, cel)
  if target == plr then return  
  outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
  end

    if not(value or cel) then
    outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    
    if not(target) then
    outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
    outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(target, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", target,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(target).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)

setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _, vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicle, true)
        elseif getElementHealth(vehicle)>301 then
            setVehicleDamageProof(vehicle, false)
        end
     end
end, 500, 0)


nie wiem, czy dobrze czy ?le. co lepiej by by?o zrobi? - zablokowa? wej?cie 2 os?b na 1 koncie ( ?eby nie mogli by? w tym samym czasie na jednym koncie ) czy zablokowa? przesy?anie do tego same uid ? Bo jak s? 2 osoby na jednym koncie to mo?na bugowa? pieni?dze ( oczywi?cie ogrpg ) je?eli kto? m?g?by to mo?e pom?c z panelem logowania: kod:

server:

addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE login=?", login)
    if result and #result > 0 then
        if result[1].login == login and result[1].pass == md5(pass) then
            local account = getAccount(login,pass)
            if account then
                logIn(client,account,pass)
            end
            setPlayerName(client, login)
            setElementData(client, "player:uid", result[1].id)
            triggerClientEvent(client, "logging:result", resourceRoot, true, nil)
                        
        else
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Podane dane s? nieprawid?owe.")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login nie istnieje w bazie.")
    end
end)
addEvent("onClientSendRegisterDataToServer", true)
addEventHandler("onClientSendRegisterDataToServer", getRootElement(), dodaj)
addEvent("logging:newAccount", true)
addEventHandler("logging:newAccount", resourceRoot, function(login,pass)
       local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE login=?", login)
    if result and #result > 0 then
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login ju? istnieje w bazie.")
    else
        local query=exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_users (login,pass) VALUES (?,?)", login, md5(pass))
        if getPlayerFromName(Player) then 
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Ktos juz jest na tym koncie.")
        else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomy?lnie zalogowa?e?/a? si?")
        end
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomy?lnie zalogowa?e?/a? si?")
            addAccount(login, pass)
            logIn(client,login,pass)
        end
    end
end)


client:

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function renderLoginBox()
    dxDrawRectangle(sx*0/1024, sy*201/768, sx*1024/1024, sy*308/768, tocolor(0, 0, 0, 188
), false)
    if data.info then dxDrawText(data.info, sx*252/1024, sy*232/768, sx*800/1024, sy*255/768, tocolor(237, 0, 0, 255), 1.00, "default", "center", "center", false) end
    dxDrawLine(sx*0/1024, sy*199/768, sx*1022/1024, sy*200/768, tocolor(31, 111, 193, 255), 5, false)
    dxDrawLine(sx*0/1024, sy*509/768, sx*1022/1024, sy*510/768, tocolor(31, 111, 193, 255), 5, false)
    dxDrawText("Second-World.pl", sx*0/1024, sy*157/768, sx*1024/1024, sy*237/768, white, 2.00, "pricedown", "center", "center", false)
    dxDrawText("U?ytkownik:", sx*256/1024, sy*272/768, sx*484/1024, sy*305/768, white, 1.00, "default-bold", "center", "center", false)
    dxDrawText("Has?o", sx*571/1024, sy*269/768, sx*799/1024, sy*302/768, white, 1.00, "default-bold", "center", "center", false)
    if not isMouseIn(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768) then dxDrawRectangle(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768, tocolor(26, 98, 197, 255), false)
    else dxDrawRectangle(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768, tocolor(0, 0, 0, 202), false) end
    if not isMouseIn(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768) then dxDrawRectangle(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768, tocolor(26, 98, 197, 255), false)
    else dxDrawRectangle(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768, tocolor(0, 0, 0, 202), false) end
    dxDrawText("Zaloguj si?", sx*255/1024, sy*408/768, sx*482/1024, sy*453/768, white, 1.00, "default", "center", "center", false)
    dxDrawText("Zarejestruj si?", sx*572/1024, sy*407/768, sx*799/1024, sy*452/768, white, 1.00, "default", "center", "center", false)
end

addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
        end
        if isMouseIn(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            if string.len(login) > 22 or string.len(pass) > 30 then
                data.info="Login/Has?o musi mie? mniej ni? 22/30 znak?w."
                return
            end
            triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
        end
    end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
    if not info then info="" end
    if value then
        data.showed=false
        showZones(data.misc)
        
        -- Usuwamy elementy
        destroyElement(data.button[1])
        destroyElement(data.button[2])
        removeEventHandler("onClientRender", root, renderLoginBox)
    else
        data.info=tostring(info)
        setTimer(function() data.info=nil end, 3000, 1)
    end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
    showChat(false)
    showCursor(true)
    fadeCamera(true)
    data.showed=true
    setElementAlpha(localPlayer,0)
    data.misc=playSound("misc/intro.mp3",true)
    setSoundVolume(data.misc, 1.0)
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje si?")
    setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    data.button[1]=guiCreateEdit(0.25, 0.41, 0.22, 0.05, "", true)
    data.button[2]=guiCreateEdit(0.56, 0.41, 0.22, 0.05, "", true)   
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 15:52


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

Szczerze to tak, zapewne lepiej by?oby zablokowa? wej?cie 2 graczy na to samo konto, ale to ju?, za wysokie progi dla mnie ;) Ja sam jeszcze si? ucz?, wi?c p?ki co postaram si? pom?c w miar? moich mo?liwo?ci.

Jak masz
function zaplacPieniadze(plr, cmd, cel, value)
   local target = znajdzGracza(plr, cel)
  if target == plr then return  
  outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
  end


To zamie? to na
function zaplacPieniadze(plr, cmd, target, value)
  if target == plr then return  
  outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
  end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 15:57


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Dalej nie dzia?a,
DB3:
ogrpg-core/cmd.lua:57: attempt to concatenate a boolean value
Kod:
--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function onPrivateMessage(plr, cmd, target, ...)
    if not target or not {...} then
        outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
        return
    end

    local text=table.concat({...}, ' ')
    local target=findPlayer(plr, target)
    if not target then
        outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
        return
    end

    outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
    outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true) 

      local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
      triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)

function zaplacPieniadze(plr, cmd, target, value)
  if target == plr then return  
  outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
  end

    if not(value or cel) then
    outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    
    if not(target) then
    outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
    outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(target, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", target,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(target).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)

setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _, vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicle, true)
        elseif getElementHealth(vehicle)>301 then
            setVehicleDamageProof(vehicle, false)
        end
     end
end, 500, 0)

Oczywi?cie to b?dzie dzia?a?o, je?eli dw?ch graczy b?dzie na jednym koncie i chcieli by bugowa? to nie b?d? mogli sobie przesy?a? tak?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 16:52


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

Ok, zr?bmy inaczej, wr??my do pierwszej mojej wersji

function zaplacPieniadze(plr, cmd, cel, value)
  if getPlayerName(cel) == getPlayerName(plr) then return  
  outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
  end

    if not(value or cel) then
    outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    
    if not(cel) then
    outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
    outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(cel, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)


Poszukaj czy w innych plikach tego zasobu jest zadeklarowana/opisana zmienna znajdzGracza.

BTW. kod kt?ry poda? Ci kolega przede mn? (elementdatanauid) by?by najlepszym wyj?ciem, a nie dzia?a? Ci, bo trzebaby by?o do niego zrobi? dodatkowy kod, kt?ry przy wej?ciu nadaje graczowi ID

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 16:58


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Dalej to samo ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 18:11


=DC=







Wiek: 36
Na forum: 4085 dni
Posty: 223
Nick w MP: =DC=

Piwa: 72

Respekt: 150
Respekt: 150Respekt: 150


function zaplacPieniadze(plr, cmd, komu, value
    local cel = getPlayerFromName(komu)
    if plr == cel then 
        outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
        return  
    end

    if (not value) or (not cel) then
        outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    if (not cel) then
        outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
        outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(cel, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)

Zamie? na to i sprawd? :P

Podpis

Witaj
, jeśli Ci pomogłem postaw mi :piwo: lub R* Dzięki!

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 19:34


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Dalej nic nie dzia?a ;///

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function onPrivateMessage(plr, cmd, target, ...)
    if not target or not {...} then
        outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
        return
    end

    local text=table.concat({...}, ' ')
    local target=findPlayer(plr, target)
    if not target then
        outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
        return
    end

    outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
    outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true) 

      local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
      triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)



function zaplacPieniadze(plr, cmd, komu, value
    local cel = getPlayerFromName(komu)
    if plr == cel then 
        outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
        return  
    end

    if (not value) or (not cel) then
        outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    if (not cel) then
        outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
        outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(cel, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)




setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _, vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicle, true)
        elseif getElementHealth(vehicle)>301 then
            setVehicleDamageProof(vehicle, false)
        end
     end
end, 500, 0)


DB:

ogrpg-core/cmd.lua:33: ')' expected near 'local'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 19:36


=DC=







Wiek: 36
Na forum: 4085 dni
Posty: 223
Nick w MP: =DC=

Piwa: 72

Respekt: 150
Respekt: 150Respekt: 150


--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function onPrivateMessage(plr, cmd, target, ...)
    if not target or not {...} then
        outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
        return
    end

    local text=table.concat({...}, ' ')
    local target=findPlayer(plr, target)
    if not target then
        outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
        return
    end

    outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
    outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true) 

      local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
      triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)



function zaplacPieniadze(plr, cmd, komu, value)
    local cel = getPlayerFromName(komu)
    if plr == cel then 
        outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr) 
        return  
    end

    if (not value) or (not cel) then
        outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
        return
    end
    
    if (not cel) then
        outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
        return
    end
    
    if tonumber(value) < 0 then return end
    if (not tonumber(value)) then return end

    if getPlayerMoney(plr) < tonumber(value) then
        outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
        return
    end
    
    takePlayerMoney(plr, tonumber(value))
    givePlayerMoney(cel, tonumber(value))
    outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
    outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)




setTimer(function()
    local vehicles=getElementsByType('vehicle')
    for _, vehicle in pairs(vehicles) do
        if getElementHealth(vehicle)<300 then
            setVehicleDamageProof(vehicle, true)
        elseif getElementHealth(vehicle)>301 then
            setVehicleDamageProof(vehicle, false)
        end
     end
end, 500, 0)

Sprawd? teraz :P

Podpis

Witaj
, jeśli Ci pomogłem postaw mi :piwo: lub R* Dzięki!

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 19:39


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Teraz skrypt dzia?a, ale nie mo?na przelewa? teraz do nikogo.
Wy?wietla si? tylko: U?yj: /zaplac <nick> <kwota>

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 19:42


=DC=







Wiek: 36
Na forum: 4085 dni
Posty: 223
Nick w MP: =DC=

Piwa: 72

Respekt: 150
Respekt: 150Respekt: 150

Je?li Ci tak pokazuje to znaczy ?e gracz do kt?rego chcesz wys?a? wiadomo?? nie jest na serwerze czyli go nie ma albo druga opcja je?li gracz ma w nicku nawiasy albo inne znaki to ich nie wpisa?e?. Musisz poda? pe?en nick np [LOL]=DC= :P

Podpis

Witaj
, jeśli Ci pomogłem postaw mi :piwo: lub R* Dzięki!

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-15, 19:45


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4026 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Dobra i tak to nie b?dzie dzia?a? inaczej by to bugowali.
Wie kto? mo?e jak zablokowa? zalogowanie 2 os?b na jedno konto?

Ostatnio zmieniony przez AlaneqYT 2016-08-15, 19:59, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: blokada :: przesyłania :: pieniędzy :: samo :: uid
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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