Hej! Mam o to taki skrypcik (kod ni?ej) i potrzebuje do niego tabeli SQL. Pr?bowa?em sam zrobi? ale totalnie mi nie wychodzi
KOD:
mysql = exports.mysql
local karnet = createMarker(1162.0380859375, -1372.5537109375, 26.046875-1, "cylinder", 2, 255, 0, 0, 100)
local trening = createMarker(1163.41796875, -1373.6650390625, 26.046875-1, "cylinder", 2, 255, 255, 255, 100)
function kupkarnet(hitElement)
exports.hud:sendBottomNotification(hitElement, "SI?OWNIA", "Aby zacz?? trening musisz zakupi? karnet aby to zrobi? wpisz /kupkarnet (Koszt $200)")
end
addEventHandler("onMarkerHit", karnet, kupkarnet)
function karnetkupiony(playerSource)
local id = getElementData(playerSource, "dbid")
local check = mysql:query_fetch_assoc("SELECT * FROM `silownia` WHERE `id` = '"..id.."'")
if check then
exports.hud:sendBottomNotification(playerSource, "SI?OWNIA", "Ju? posiadasz karnet!")
else
if isElementWithinMarker(playerSource, karnet) then
if exports.global:hasMoney(playerSource, 200) then
exports.hud:sendBottomNotification(playerSource, "SI?OWNIA", "Gratulacje! Zakupi?e? karnet na si?ownie!")
exports.global:takeMoney(playerSource, 200)
mysql:query_free("INSERT INTO `silownia` SET `id` = '"..id.."'")
mysql:query_free("UPDATE `silownia` SET `sila` = '1' WHERE `id` = '"..id.."'")
end
end
end
end
addCommandHandler("kupkarnet", karnetkupiony)
function sila(hitElement)
triggerEvent("sendAme", hitElement, "uderza pare razy w worek")
exports.hud:sendBottomNotification(hitElement, "SI?OWNIA", "Rozpocz??e? trening!")
setElementFrozen(hitElement, true)
toggleAllControls(hitElement, false)
setPedAnimation(hitElement, "GYMNASIUM", "GYMshadowbox")
setTimer ( function()
triggerEvent("sendAdo", hitElement, "Po sko?czonym treningu usiad? na ?aweczce popijaj?c wode")
exports.hud:sendBottomNotification(hitElement, "SI?OWNIA", "Zako?czy?e? trening!")
setElementFrozen(hitElement, false)
toggleAllControls(hitElement, true)
setPedAnimation(hitElement)
mysql:query_free("UPDATE `silownia` SET `sila` = '50' WHERE `id` = '"..id.."'")
end, 5000, 1)
end
addEventHandler("onMarkerHit", trening, sila)
|