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

Wysłany: 2015-08-03, 10:31


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

Siemanko. Mam kod lecz nie wiem czy to jest na dawanie kasy czy na zapis ale po funkcjach widz? ze to jest na dawanie siana. A gdzie w tym kodzie jest komenda? Nie widz? tu addComend.
Oto kod:

_root getRootElement()

function giveMoney(thePlayeramount)
    if ( typetonumber(amount) ) == "number" and getElementTypethePlayer ) == "player" then
        if ( amount == then
            return true
        elseif ( thePlayer and isElement(thePlayer) and tonumber(amount) > then
                amount math.floortonumber(amount) )
        
                setElementData(thePlayer"money"getMoneythePlayer ) + amount )
                local resulterror exports.sql:query_free("UPDATE `characters` SET `cash` = cash + " .. amount .. " WHERE charid = '" .. getElementDatathePlayer"characterID" ) .."'" )
                if ( result then
                    givePlayerMoneythePlayeramount )
                else
                    return outputDebugStringerror )
                end
            return true
        end
        return false
    else
        return outputDebugString("MISSING_ARGUMENTS")
    end
end

function takeMoney(thePlayeramountrest)
    amount tonumberamount ) or 0
    if amount == 0 then
        return true0
    elseif thePlayer and isElement(thePlayer) and amount 0 then
        amount math.ceilamount )
        
        local money getMoneythePlayer )
        if rest and amount money then
            amount money
        end
        
        if amount == 0 then
            return true0
        elseif hasMoney(thePlayeramountthen
            setElementData(thePlayer"money"money amount )
            if getElementType(thePlayer) == "player" then
                exports.sql:query_free("UPDATE `characters` SET `cash` = cash - " .. amount .. " WHERE charid = '" .. getElementDatathePlayer"characterID" ) .."' " )
                takePlayerMoneythePlayeramount )
            return trueamount
            end
        end
    return false0
    end
end

function setMoney(thePlayeramount)
    amount tonumberamount ) or 0
    if thePlayer and isElement(thePlayer) and amount >= 0 then
        amount math.flooramount )
        
        setElementData(thePlayer"money"amount )
        if getElementType(thePlayer) == "player" then
            exports.sql:query_free("UPDATE characters SET money = " .. amount .. " WHERE charid = " .. getElementDatathePlayer"dbid" ) )
            setPlayerMoneythePlayeramount )
        elseif getElementType(thePlayer) == "team" then
            exports.sql:query_free("UPDATE factions SET bankbalance = " .. amount .. " WHERE charid = " .. getElementDatathePlayer"id" ) )
        end
        return true
    end
    return false
end

function hasMoney(thePlayeramount)
    amount tonumberamount ) or 0
    if thePlayer and isElement(thePlayer) and amount >= 0 then
        amount math.flooramount )
        
        return getMoney(thePlayer) >= amount
    end
    return false
end

function getMoney(thePlayernocheck)
    if not nocheck then
        checkMoneyHacks(thePlayer)
    end
    return getElementData(thePlayer"money") or 0
end

function checkMoneyHacks(thePlayer)
    if not getMoney(thePlayertrue) or getElementType(thePlayer) ~= "player" then return end
    
    local safemoney getMoney(thePlayertrue)
    local hackmoney getPlayerMoney(thePlayer)

    if (safemoney~=hackmoneythen
        --banPlayer(thePlayergetRootElement(), "Money Hacks: " .. hackmoney .. "$.")
        setPlayerMoney(thePlayersafemoney)
        --sendMessageToAdmins("Possible money hack detected: "..getPlayerName(thePlayer))
        return true
    else
        return false
    end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 10:41


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Bo to jest na dawanie kasy poprzez mysql

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 10:43


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

I tu niema ?adnej komendy? Po prostu w bazie ustawiamy kase?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 10:48


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Tak, w bazie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 21:21


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Tu s? funkcje nie tylko do dawania, ale og?lnie do zarz?dzania pieni?dzmi gracza.

#Tak troche s?abo u?ywa? tego antyczita valhalli, ?atwo go obej?? :D

Postaw piwo autorowi tego posta
 

 
Tagi: czy :: zapis?
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