Witajcie dzisiaj zwracam si? do was z nie znanym mi b??dem a mianowicie .
WARNING: [rpg]/rpg_mysql/mysql_server.lua:21: dbPoll failed; Unknown column 'uid' in 'where clause'
ERROR: [rpg]/rpg-FireDep/s.lua:38: attempt to get length of local 'result' (a boolean value)
dodam ?e s? to frakcj? z onh i mysql jest poprawnie zrobione , prosi? bym o szybk? pomoc w tym problemie .
Nagroda dla osoby kt?ra mi pomo?e to piwko i respekt .
[lua] function findPlayer(plr, cel)
local target = nil
if (tonumber(cel) ~= nil) then
target = getElementByID("p"..cel)
else
for _,thePlayer in ipairs(getElementsByType("player")) do
if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), cel:lower(), 1, true) then
if (target) then
outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter.", plr)
return nil
end
target=thePlayer
end
end
end
return target
end
local licz = {}
local rozpoczecie = createMarker(-316.72,1779.09,47.09-0.9, "cylinder", 1.2, 0, 255, 255, 75)
local liderPanel = createMarker(-308.10,1778.74,47.09-0.9, "cylinder", 1.2, 0, 255, 255, 75)
addEventHandler("onMarkerHit", rozpoczecie, function(player)
local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=? AND frakcja=?", getElementData(player, "user:uid"), "SAFD")
if #result > 0 then
if getElementData(player, "user:faction") then
zatrzymajnaliczanie(player)
setElementData(player, "user:faction", false)
setElementData(player, "user:factionrank", false)
takeWeapon(player, 31)
takeWeapon(player, 3)
takeWeapon(player, 23)
toggleControl(player, "fire", false)
toggleControl(player, "aim_weapon", false)
setElementModel(player, getElementData(player, "user:lastskin"))
exports.rpg_noti:createNotification(player, "info", "Zako?czy?e? prac? w frakcji San Andreas Fire Departament.")
else
rozpocznijnaliczanie(player)
setElementData(player, "user:faction", "SAFD")
setElementData(player, "user:factionrank", result[1].rank)
giveWeapon(player, 31, 9999)
giveWeapon(player, 3, 9999)
giveWeapon(player, 23, 9999)
toggleControl(player, "fire", true)
toggleControl(player, "aim_weapon", true)
setElementData(player, "user:lastskin", getElementModel(player))
exports.rpg_noti:createNotification(player, "info", "Rozpocz??e? prac? w frakcji San Andreas Fire Departament.")
end
else
exports.rpg_noti:createNotification(player, "error", "Nie jeste? w frakcji San Andreas Fire Departament.")
end
end)
addEventHandler("onMarkerHit", liderPanel, function(player)
if not getElementData(player, "user:faction") == "SAFD" then return end
local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=? AND frakcja=?", getElementData(player, "user:uid"), "SAFD")
if result[1].rank == 4 or result[1].rank == 3 then
exports.rpg_noti:createNotification(player, "info", "Komendy: /dodaj <id gracza>, <wyrzuc> <id gracza>, /edytuj <id gracza> <nowa ranga 1-3>")
setElementData(player, "liderpanel:on:SAFD", true)
else
exports.rpg_noti:createNotification(player, "error", "Nie jeste? w frakcji San Andreas Fire Departament lub nie masz uprawnie? do panelu.")
end
end)
addEventHandler("onMarkerLeave", liderPanel, function(player)
if not getElementData(player, "user:faction") == "SAFD" then return end
local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=? AND frakcja=?", getElementData(player, "user:uid"), "SAFD")
if result[1].rank == 4 or result[1].rank == 3 then
setElementData(player, "liderpanel:on:SAFD", false)
end
end)
addCommandHandler("dodaj", function(plr, cmd, kto)
if getElementData(plr, "liderpanel:on:SAFD") then
if not kto then
outputChatBox("U?yj /dodaj <id gracza>", plr, 0, 255, 0)
return
end
local target = findPlayer(plr, kto)
if not target then return end
local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=? AND frakcja=?", getElementData(target, "user:uid"), "SAFD")
if #result < 0 then
exports.rpg_noti:createNotification(plr, "error", ""..getPlayerName(target).." znajduje si? w tej frakcji.")
return
end
exports.rpg_noti:createNotification(plr, "info", "Dodano gracza "..getPlayerName(target).." do frakcji na rang? 1.")
exports.rpg_mysql:mysql_query("INSERT INTO rpg_factions SET uid=?, frakcja=?, rank=?", getElementData(target, "user:uid"), "SAFD", "1")
end
end)
addCommandHandler("wyrzuc", function(plr, cmd, kto)
if getElementData(plr, "liderpanel:on:SAFD") then
if not kto then
outputChatBox("U?yj /wyrzuc <id gracza>", plr, 0, 255, 0)
return
end
local target = findPlayer(plr, kto)
if not target then return end
local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=? AND frakcja=?", getElementData(target, "user:uid"), "SAFD")
if #result < 0 then
exports.rpg_noti:createNotification(plr, "error", ""..getPlayerName(target).." znajduje si? w tej frakcji.")
return
end
exports.rpg_noti:createNotification(plr, "info", "Usuni?to gracza "..getPlayerName(target).." z frakcji.")
exports.rpg_mysql:mysql_query("DELETE FROM rpg_factions WHERE frakcja=? AND uid=?", "SAFD", getElementData(target, "user:uid"))
end
end)
addCommandHandler("edytuj", function(plr, cmd, kto, ranga)
if getElementData(plr, "liderpanel:on:SAFD") then
if not kto then
outputChatBox("U?yj /edytuj <id gracza>", plr, 0, 255, 0)
return
end
local target = findPlayer(plr, kto)
if not target then return end
local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=? AND frakcja=?", getElementData(target, "user:uid"), "SAFD")
if #result < 0 then
exports.rpg_noti:createNotification(plr, "error", ""..getPlayerName(target).." nie znajduje si? w tej frakcji.")
return
end
exports.rpg_noti:createNotification(plr, "info", "Edytowano gracza "..getPlayerName(target)..".")
exports.rpg_mysql:mysql_query("UPDATE rpg_factions SET rank=? WHERE uid=?", ranga, getElementData(target, "user:uid"))
end
end)
local remiza = createBlip(-314.21,1763.17,47.98, 20)
local pojazdy = {
{407, -315.1826171875, 1777.5751953125, 43.011371612549, 270.28570556641, "#001\nSan Andreas Fire Departament"},
{407, -315.1884765625, 1773.0087890625, 43.016666412354, 270.19781494141, "#002\nSan Andreas Fire Departament"},
{407, -315.1855859375, 1768.076171875, 43.016262054443, 269.31869506836, "#001\nSan Andreas Fire Departament"},
{544, -314.111328125, 1761.7822265625, 43.012157440186, 271.25274658203, "#011\nSan Andreas Fire Departament"},
{560, -314.240234375, 1757.0908203125, 42.471462249756, 271.78021240234, "#021\nSan Andreas Fire Departament"},
{552, -314.7841796875, 1752.673828125, 42.44221496582, 268.79119873047, "#031\nSan Andreas Fire Departament"},
}
kogut1 = createObject ( 2217, 0, 0, 0, 0, 0, 0 )
kogut2 = createObject ( 2218, 0, 0, 0, 0, 0, 0 )
kogut3 = createObject ( 2221, 0, 0, 0, 0, 0, 0 )
kogut4 = createObject ( 2221, 0, 0, 0, 0, 0, 0 )
for _,v in ipairs(pojazdy)do
local vehicle = createVehicle(v[1], v[2], v[3], v[4], 0, 0, v[5])
local acceleration = getVehicleHandling(vehicle).engineAcceleration
local velocity = getVehicleHandling(vehicle).maxVelocity
local mass = getVehicleHandling(vehicle).mass
local turnmass = getVehicleHandling(vehicle).turnMass
local mutlipiler = getVehicleHandling(vehicle).tractionMultiplier
local coef = getVehicleHandling(vehicle).dragCoeff
if v[1] == 407 then
setElementData(vehicle, "veh:factionrank", 1)
setVehicleColor(vehicle, 255, 0, 0, 255, 255, 255)
setVehicleHandling(vehicle, "steeringLock", 40)
setVehicleHandling(vehicle, "engineAcceleration", acceleration+5)
setVehicleHandling(vehicle, "driveType", "awd")
removeVehicleSirens(vehicle)
addVehicleSirens(vehicle, 4, 2, false, false, false, true)
setVehicleSirens(vehicle, 1, -0.7, 3.1, 1.3, 255, 0, 0, 255, 255)
setVehicleSirens(vehicle, 2, -0.7, -3.2, 1.5, 255, 255, 255, 255, 255)
setVehicleSirens(vehicle, 3, 0.6, 3.1, 1.3, 0, 0, 255, 255, 255)
setVehicleSirens(vehicle, 4, 0.6, -3.2, 1.5, 255, 255, 255, 255, 255)
elseif v[1] == 544 then
setVehicleColor(vehicle, 255, 0, 0, 255, 255, 255)
elseif v[1] == 560 then
attachElements (kogut3, vehicle, -0.6, 0.15, 0.77, 0, 35, 90 )
setVehicleColor(vehicle, 255, 0, 0, 255, 255, 255)
removeVehicleSirens(vehicle)
addVehicleSirens(vehicle, 2, 2, true, false, true, true)
setVehicleSirens(vehicle, 1, 0.6, 0, 0.9, 255, 0, 0, 198.9, 198.9)
setVehicleSirens(vehicle, 2, -0.6, 0, 0.9, 0, 0, 255, 200, 200)
elseif v[1] == 552 then
setVehicleColor(vehicle, 255, 0, 0, 255, 255, 255)
attachElements (kogut1, vehicle, -0.6, 0.7, 1.39, 0, 0, 0 )
attachElements (kogut2, vehicle, 0.6, 0.7, 1.39, 0, 0, 0 )
removeVehicleSirens(vehicle)
addVehicleSirens(vehicle, 2, 2, false, false, false, true)
setVehicleSirens(vehicle, 1, -0.6, 0.7, 1.39, 255, 0, 0, 255, 255)
setVehicleSirens(vehicle, 2, 0.6, 0.7, 1.39, 0, 0, 255, 255, 255)
end
setElementData(vehicle, "veh:opis", v[6])
setElementFrozen(vehicle, true)
addVehicleUpgrade(vehicle, 1025)
setElementData(vehicle, "veh:SAFD", true)
end
addEventHandler("onVehicleStartEnter", resourceRoot, function(plr, seat, jacked)
if seat ~= 0 then return end
if getElementData(plr, "user:faction") == "SAFD" then
else
cancelEvent()
exports.rpg_noti:createNotification(plr, "error", "Nie Mo?esz Wejs? Do Tego Pojazdu!")
end
end)
local skiny = createMarker(-308.92,1747.68,47.09-0.9, "cylinder", 2, 65, 255, 255, 65)
napis3 = createElement("text")
setElementPosition(napis3, -308.92,1747.68,47.09)
setElementData(napis3, "text", "Przebieralnia")
addEventHandler("onMarkerHit", skiny, function(player)
if getElementData(player, "user:faction") == "SAFD" then
exports.rpg_noti:createNotification(player, "info", "Aby zmieni? skina wpisz /skin <id (1)")
setElementData(player, "SAFD:przebieralnia", true)
end
end)
addEventHandler("onMarkerLeave", skiny, function(player)
if getElementData(player, "user:faction") == "SAFD" then
setElementData(player, "SAFD:przebieralnia", false)
end
end)
skiny = {
["1"] = true,
}
addCommandHandler("skin", function(plr, cmd, id)
if getElementData(plr, "SAFD:przebieralnia") then
if not id then exports.rpg_noti:createNotification(plr, "info", "Aby zmieni? skina wpisz /skin <id (1)") return end
if not skiny[id] then exports.rpg_noti:createNotification(plr, "info", "Aby zmieni? skina wpisz /skin <id (1)") return end
exports.rpg_noti:createNotification(plr, "info", "Zmieni?e? swojego skina na skin id "..id.."")
setElementModel(plr, id)
end
end)
function rozpocznijnaliczanie(plr)
if isTimer(licz[plr]) then
killTimer(licz[plr])
licz[plr] = nil
end
licz[plr] = setTimer(naliczanie,60000,0,plr)
end
function zatrzymajnaliczanie(plr)
if isTimer(licz[plr]) then
killTimer(licz[plr])
licz[plr] = nil
end
end
addEventHandler("onPlayerWasted",root,function()
if isTimer(licz[source]) then
killTimer(licz[source])
licz[source] = nil
end
end)
function naliczanie(plr)
if isElement(plr) then
local wyplata = getElementData(plr, "user:factionmoney") or 0
exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET ftime=? WHERE uid=?", wyplata+1, getElementData(plr, "user:uid"))
setElementData(plr, "user:factionmoney", wyplata+1)
else
if isTimer(licz[plr]) then
killTimer(licz[plr])
licz[plr] = nil
end
end
end
addEvent("torebka1", true)
addEventHandler("torebka1", root, function()
if getElementData(localPlayer,"ONr1") then
setElementData(localPlayer, "ONr1", false)
destroyElement( case )
outputChatBox("Schowa?e? torb? R1 do baga?nika")
else
setElementData(localPlayer, "ONr1", true)
case = createObject(1210,0,0,0)
exports.bone_attach:attachElementToBone(case, localPlayer, 12,0,0.05,0.27,0,180,0)
outputChatBox("Wyj??e? torb? R1 z baga?nika")
end
end)
[/lua]
|