Witam, dopiero zaczynam si? "bawi?" w serwer MTA:SA.
Najwi?kszy prob mam z MySQL, nie mog? znale?? ?adnego poradnika jak podpina? skrypty MTA:SA. Dzi? znalaz?em na waszym forum skrypt odpowiadaj?cy za logowanie/rejestracj? (http://gtao.pl/%3Cfont-colorcccc99%3Eskrypt%3C-font%3E-autorski-panel-logowania-vt100931.htm), ale nie dzia??. Wiem dla czego - ?le podpie?em MySQL.
Dlatego mam kilka pyta?.
1. Mam baz? MySQL (hosting 1shot1kill) i jaki jest port oraz host?
2. Zrobi?em podan? tabel? i jest tak jak tam pisze. Tylko to wystarczy czy trzeba skrypt odpowiadaj?cy g??wnie za MySQL?
3. Prosi?bym o uzupe?nienie mi tego:
Telsky, hosta i wszystkie dane musisz mie? podane na hostingu, a do po??czenia z baz? MySQL najlepiej stworzy? plik DB. A w przypadku tego wy?ej pomi?dzy tymi " " w tabeli u g?ry skryptu uzupe?niasz dane MySQL
Chce zeby gracz ktory wjedzie w marker nie mogl z niego wyjechac przed zaplata.
Czyli trzeba dodac frozena i zeby nie mogl placic jak nie ma 20pln
c.lua
local marker=createMarker(1710.05176, -808.82965, 56.35443, 'corona', -1, 235, 155,0,250)
function MarkerHit ( hitPlayer, matchingDimension )
outputChatBox ( " Tak Naprawde Wesley to cj")
end
addEventHandler("onClientMarkerHit", getRootElement(), MarkerHit )
function zaplac ( thePlayer, command ,amount)
takePlayerMoney ( thePlayer, tonumber( 20 ) )
end
addCommandHandler ( "zaplac" , zaplac)
s.lua
function toggleFreezeStatus ( thePlayer )
local playerVehicle = getPlayerOccupiedVehicle ( thePlayer )
local currentFreezeStatus = isElementFrozen ( playerVehicle )
local newFreezeStatus = not currentFreezeStatus
setElementFrozen ( playerVehicle, newFreezeStatus )
end
witam mam pro?b? o napisanie skryptu na towary i na hud kt?ry ma liczb? towar?w i stan pojazd?w i walut? pln i zycie i kamizelke towary dok?adnie to legalne i nie legalne w za?oczniku daje wam markery i liste towar?w
Prosze o przerobienie skryptu na rozmowy mi?dzy frakcjami.
Kiedy jestem na s?u?bie to chat widz? gracze kt?rzy nie s? na s?u?bie.
addCommandHandler("frakcja",function(plr, cmd, ...)
if not getElementData(plr, "player:duty") then return end
local msg = table.concat ( { ... }, " " )
for i,v in pairs(getElementsByType("player")) do
if getElementData(plr, "player:duty")=="SPD" then
outputChatBox("#FFFFFF[#2AD7DEFrakcja#FFFFFF]#0000FF SPD #FF9933"..getPlayerName(plr).."#FFFFFF"..msg.."",v,255,255,255,true)
elseif getElementData(plr,"player:duty")=="SES" then
outputChatBox("#FFFFFF[#2AD7DEFrakcja#FFFFFF]#25D6BE SES #FF2266"..getPlayerName(plr).." #FFFFFF "..msg.."",v,255,255,255,true)
elseif getElementData(plr,"player:duty")=="SATC" then
outputChatBox("#FFFFFF[#2AD7DEFrakcja#FFFFFF]#EBF711 SATC #FF2266"..getPlayerName(plr).." #FFFFFF "..msg.."",v,255,255,255,true)
elseif getElementData(plr,"player:duty")=="FBSA" then
outputChatBox("#FFFFFF[#2AD7DEFrakcja#FFFFFF]#F71115 FBSA #FF2266"..getPlayerName(plr).." #FFFFFF "..msg.."",v,255,255,255,true)
end
end
end)
addCommandHandler("sluzba",function(plr, cmd, ...)
if not getElementData(plr, "player:duty") then return end
local msg = table.concat ( { ... }, " " )
for i,v in pairs(getElementsByType("player")) do
if getElementData(v, "player:duty") then
triggerClientEvent(v,"radio",v)
if getElementData(plr,"player:duty") =="SPD" then
outputChatBox("#FFFFFF[#FF0000S?u?by#FFFFFF]#0000FF State Police Department #FF9933"..getPlayerName(plr).." #FFFFFF"..msg.."",plr,255,255,255,true)
elseif getElementData(plr, "player:duty")=="SES" then
outputChatBox("#FFFFFF[#FF0000S?u?by#FFFFFF]#25D6BE State Emergency Services #FF2266"..getPlayerName(plr).." #FFFFFF"..msg.."",v,255,255,255,true)
elseif getElementData(plr, "player:duty") =="SATC" then
outputChatBox("#FFFFFF[#FF0000S?u?by#FFFFFF]#EBF711 SATC #FF2266"..getPlayerName(plr).." #FFFFFF"..msg.."",v,255,255,255,true)
elseif getElementData(plr, "player:duty") =="FBSA" then
outputChatBox("#FFFFFF[#FF0000S?u?by#FFFFFF]#F71115 FBSA #FF2266"..getPlayerName(plr).." #FFFFFF"..msg.."",v,255,255,255,true)
elseif getElementData(plr, "player:duty") =="SBG" then
outputChatBox("#FFFFFF[#FF0000S?u?by#FFFFFF]#F71115 SBG #FF2266"..getPlayerName(plr).." #FFFFFF"..msg.."",v,255,255,255,true)
end
end
end
end)
addEventHandler("onResourceStart",resourceRoot,function()
for _,plajer in pairs(getElementsByType("player")) do
bindKey(plajer, "y", "down", "chatbox", "frakcja")
bindKey(plajer, "u", "down", "chatbox", "sluzba")
end
end)
Witam ma taki kod i chcia? bym ten kod do ogrpg saveplayers bo ja go nie umiem tam wklej? bo nie wiem jak za to daje .
local sid = getElementData(plr, "player:uid")
if sid then
local result = exports['ogrpg-db']:dbGet('select * from og_premium where uid=? and date > now()', sid)
if result and #result > 0 then
setElementData(element, 'player:premium', true)
outputChatBox('Posiadasz aktywn? us?ug? Premium.\nJest ona aktywna do: '.. result[1]['premium'] ..'.', plr)
outputChatBox('Aby przed?u?y? us?ug? Premium wpisz /premium.', plr)
end
local result = exports['ogrpg-db']:dbGet('select * from og_premium where uid=? and date < now()', sid)
if result and #result > 0 then
if result[1]['premium'] ~= '0000-00-00 00:00:00' then
local query = exports['ogrpg-db']:dbSet('update og_premium set date="0000-00-00 00:00:00" where uid=?', sid)
if query then
setElementData(element, 'player:premium', false)
outputChatBox('Twoja us?uga Premium wygas?a!', plr)
outputChatBox('Aby zakupi? ponownie us?ug? Premium wpisz /premium.', plr)
end
end
end
end
ten kod do g?ry bym chcia? wklej? do tego kodu zeby dzia?a?o.
--[[
Resource: OURGame v2
Developers: Split <[email protected]>
You have no right to use this code without my permission.
(c) 2015 <[email protected]>. All rights reserved.
]]
function getPremium(plr,premium)
if premium then
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=? AND premium=?",getElementData(plr,"player:sid"), premium)
if result and #result > 0 then
return true
else
return false
end
else
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", getElementData(plr,"player:sid"))
if result and #result > 0 then
return true
else
return false
end
end
end
function loadPlayerData(plr)
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", getElementData(plr,"player:sid"))
if result and #result > 0 then
local v=result[1]
setPlayerMoney(plr,v.money)
setElementModel(plr,v.skin)
setElementData(plr,"status","Aktywny")
setElementData(plr,"player:logged",true)
setElementData(plr,"player:mandate",v.mandate)
setElementData(plr,"player:license:pjA",v.pjA)
setElementData(plr,"player:license:pjB",v.pjB)
setElementData(plr,"player:license:pjC",v.pjC)
setElementData(plr,"player:license:pjL",v.pjL)
setElementData(plr,"player:rep",v.rep)
setElementData(plr,"player:workinjob",v.worker)
setElementData(plr,"player:registerdate",v.registered)
setElementData(plr,"player:hours",v.hours)
setElementData(plr,"player:skin",v.skin)
local queryA=string.format("SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(plr,"player:sid"))
local resultA=exports["DB2"]:pobierzWyniki(queryA)
if (resultA) then
setElementData(plr,"player:premium",true)
setElementData(plr,"player:premiumdate",v.premiumdate)
setPlayerName(plr,"#F6FF00"..getPlayerName(plr))
setElementData(plr,"premium:level",1)
else
setElementData(plr,"player:premium",false)
end
--local queryA=string.format("SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(plr,"player:uid"))
--local resultA=exports["ogrpg-db"]:dbSet(queryA)
--if (resultA) then
--[[if getPremium(plr,1) then
setElementData(plr,"player:premium",true)
setElementData(plr,"player:premiumdate",v.premiumdate)
setPlayerName(plr,"#FFFF00"..getPlayerName(plr))
else
setElementData(plr,"player:premium",false)
end--]]
-- org
--local org=exports["ogrpg-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1", getElementData(plr,"player:organization"), getElementData(plr,"player:sid")) -- pobieramy tylko JEDEN rekord
--local name = getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
--if org and #org > 0 then
--setElementData(plr,"player:organization",org[1].code)
--outputChatBox("* Jeste? w organizacji, kt?ra nosi nazwe: "..org[1].code.."", plr)
--exports['ogrpg-db']:dbSet("UPDATE ms_organizacje SET actived=curdate() WHERE uid=?", getElementData(plr,"player:sid"))
--end
--local org=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1", getElementData(plr,"player:organization"), getElementData(plr,"player:sid"))
--local org=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? LIMIT 1", getElementData(plr,"player:sid")) -- pobieramy tylko JEDEN rekord
--if org and #org > 0 then
--setElementData(plr,"player:organization",org[1].code)
--outputChatBox("* Jeste? w organizacji, kt?ra nosi nazwe: "..org[1].code.."", plr)
--exports['ogrpg-db']:dbSet("UPDATE ogrpg_organization_list WHERE id=? AND uid=?", id, uid)
--\\\--exports['ogrpg-db']:dbSet("UPDATE ogrpg_organizations SET actived=curdate() WHERE uid=?", getElementData(plr,"player:sid"))
--end
local org=exports["ogrpg-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1", getElementData(plr,"player:organization"), getElementData(plr,"player:sid")) -- pobieramy tylko JEDEN rekord
local name = getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
if org and #org > 0 then
setElementData(plr,"player:organization",org[1].code)
outputChatBox("✪ Jeste? w organizacji, kt?ra nosi nazwe: "..org[1].code.."", plr)
exports['ogrpg-db']:dbSet("UPDATE ms_organizacje SET actived=curdate() WHERE uid=?", getElementData(plr,"player:sid"))
end
return true
end
return false
end
addEvent("load:player",true)
addEventHandler("load:player", root, function(player)
if isElement(player) and player then
if getElementType(player) ~= "player" then return end
loadPlayerData(player)
outputDebugString("ogrpg_users> Za?adowano statystyki gracza: "..getPlayerName(player))
end
end)
function savePlayerData(plr)
local sid=getElementData(plr,"player:sid")
if not sid then return end
local money=getPlayerMoney(plr)
local mandate=getElementData(plr,"player:mandate")
local licensea=getElementData(plr,"player:license:pjA")
local licenseb=getElementData(plr,"player:license:pjB")
local licensec=getElementData(plr,"player:license:pjC")
local licensel=getElementData(plr,"player:license:pjL")
local srp=getElementData(plr,"player:rep")
local worker =getElementData(plr,"player:workinjob")
local hours= tonumber(getElementData(plr,"player:hours")) or 0
local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET money=?, rep=?, mandate=?, pjA=?, pjB=?, pjC=?, pjL=?, worker=?, hours=? WHERE id=?",
money, srp, mandate, licensea, licenseb, licensec, licensel, worker, hours, sid)
end
addEvent("save:player",true)
addEventHandler("save:player", root, function(player)
if isElement(player) and player then
if getElementType(player) ~= "player" then return end
savePlayerData(player)
outputDebugString("ogrpg_users> Zapisano statystyki gracza: "..getPlayerName(player))
end
end)
addEventHandler("onPlayerQuit", root, function() savePlayerData(source) end)
moveObject (gate, 1000, -6720.42,-1474.60,97.41 )
if getElementData(thePlayer,'player:duty') and getElementData(thePlayer,'player:duty')=='KGPLV' then
moveObject ( brama1, 2000, -2563.7,617.09998,15.4)
end
end
end
Przerobi mi kto? to, ?eby brama otwiera?a si? gdy gracz jest w mysql we frakcji a nie na sluzbie. Daje zimnego browara
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