Wysłany: 2021-01-14, 20:46
Matplpl
Wiek: 22 Na forum: 2624 dni Posty: 6
Nick w MP: matplpl
Piwa : 225
Siema, bawi?em si? z tym troch? i troch? nie ogarniam jak to zrobi?.
Przy zakupie auta w salonie bierze kase z portfela a chc? zrobi? ?eby z banku bra?o.
ElementData banku to bank:hajs
getElementData(localPlayer,"bank:hajs")
Kod: addEvent("buyVehicle", true)
addEventHandler("buyVehicle", resourceRoot, function(model, mileage, cost, capacity)
cost=tonumber(cost)
if model and mileage and cost then
if cost <= client.money then
local uid = client:getData("player:uid")
if not uid then return false end
client:takeMoney(cost)
triggerClientEvent(client, "onClientAddNotification", client, "Zakupi?e?(a?) pojazd prywatny, znajdziesz go w przechowalni pojazd?w.", "success")
exports["ogrpg-db"]:dbGet("INSERT INTO ogrpg_vehicles (model, ownedPlayer, firstowner, mileage, parking, capacity) VALUES (?,?,?,?,1,?)", model, uid, client.name, mileage, capacity)
else
triggerClientEvent(client, "onClientAddNotification", client, "Nie posiadasz wystarczajacej kwoty pieni?dzy!\n(Brakuje Ci: "..string.format("%.02fPLN", cost-client.money)..")", "error")
end
end
end)
Wysłany: 2021-01-14, 20:57
xyzzz^
A nic
Wiek: 18 Na forum: 1993 dni Posty: 319
Nick w MP: Aspyk21
Piwa : 308
Wysłany: 2021-01-15, 22:03
Lucky!!! :)
Wiek: 20 Na forum: 2372 dni Posty: 121
Nick w MP: Lucky
Piwa : 1163
Trzymaj, powinno by? git. Jak ju? to uzupe?nij exporta do bazy o zabieraniu kasy z banku, bo nie znam db og-rpg.
addEvent ( "buyVehicle" , true )
addEventHandler ( "buyVehicle" , resourceRoot , function( model , mileage , cost , capacity )
cost = tonumber ( cost )
local money_bank = getElementData ( client , "bank:hajs" )
if model and mileage and cost then
if cost <= money_bank then
local uid = getElementData ( client , "player:uid" )
if not uid then return false end
exports [ "ogrpg-db" ]: dbSet ( "UPDATE `ogrpg_users` SET `bank_money` = `bank_money` - ? WHERE `ogrpg_users`.`id` = ?" , cost , getElementData ( client , "player:uid" ))
triggerClientEvent ( client , "onClientAddNotification" , client , "Zakupi?e?(a?) pojazd prywatny, znajdziesz go w przechowalni pojazd?w." , "success" )
exports [ "ogrpg-db" ]: dbGet ( "INSERT INTO ogrpg_vehicles (model, ownedPlayer, firstowner, mileage, parking, capacity) VALUES (?,?,?,?,1,?)" , model , uid , client . name , mileage , capacity )
else
triggerClientEvent ( client , "onClientAddNotification" , client , "Nie posiadasz wystarczajacej kwoty pieni?dzy!\n(Brakuje Ci: " .. string . format ( "%.02fPLN" , cost - money_bank ).. ")" , "error" )
end
end
end )
Tagi: salony :: biorą :: kase :: portfela :: nie :: banku
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: