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

Wysłany: 2013-08-23, 18:14


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Witam. Kupi?em gamemode do mta ale potrzebne jest tam po??czenie z baz? danych MySQL. W mta trzeba by?o wgra? jakie? modu?y wiec je wgra?em ale co? nie dzia?a(korzysta?em z tego poradnika: http://www.gtao.pl/tut-mysql-vt58249.htm ).
Problem polega na tym ?e wszystko po??czy?em dobrze ale kiedy uruchamiam ten gamemode kt?ry kupi?em to wyskakuje taki b??d: ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on "localhost" (10061).
PS: Korzystam z bazy MySQL z mojej strony www.
Prosze o pomoc i pozdrawiam,
Troll

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 02:37


Tostuch







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

Piwa: 137

Respekt: 110
Respekt: 110

Poka? kod kt?rym si? logujesz do bazy oraz konfiguracj?, oczywi?cie bez hase?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 08:05


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Przepraszam ale nie za bardzo rozumiem. Chodzi ci o ten plik settings.xml jest on w mods/deathmatch ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 08:41


Tostuch







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

Piwa: 137

Respekt: 110
Respekt: 110

Chodzi mi o plik w kt?rym ??czysz si? z baz? oraz ten skrypt gdzie pobiera dane. Zazwyczaj s? one nazwane sql, mysql czy co? takiego. Poszukaj. Mo?liwe nazwy to te? db, dbquery.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 09:27


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

a gdzie jest ten plik ? w mods/deathmatch/resources ? czy w tym gamemodzie co kupilem ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 09:42


zabijaka2000







Wiek: 26
Na forum: 4983 dni
Posty: 147
Nick w MP: aleks556

Piwa: 13

Respekt: 80

Ostrzeżeń: 20%
W tym gamemodzie co kupi?e? ...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 09:48


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

A wiec w tym pliku wpisywalem haslo itp. kod:
Kod:

MYSQL_SERVER="localhost"
MYSQL_USERNAME="ironmine"
MYSQL_PASSWORD=""
MYSQL_DB="ironmine"
MYSQL_PORT="3306"

I pewnie chodzi ci o ten plik (jak nie to napisz :D ) kod:
Kod:

MYSQL_SERVER,MYSQL_USERNAME,MYSQL_PASSWORD,MYSQL_DB)
if not handle then
return
end
setTimer(restartDataBase,600000,1)
end

-------------------------------------------------------------------
-- save/loadStats
-------------------------------------------------------------------
function saveStats(thePlayer,debuger)
local postacID = getPlayerID(thePlayer)
if thePlayer then
if isPlayerLoged(thePlayer) then
setElementData(thePlayer,"ostatnio",getRealTime().timestamp)
local String = ""
for j=2,#DanePostacie do
local data = getElementData(thePlayer,DanePostacie[j])
if not data or data == false then data = 0 end
if DanePostacie[j] == "czas" then
data = data+(getElementData(thePlayer,"czasToday") and getElementData(thePlayer,"czasToday") or 0)
elseif DanePostacie[j] == "frakcja" then
if getPlayerTeam ( thePlayer ) == KierowcyTeam then data = 0 end
if getPlayerTeam ( thePlayer ) == PolicjaTeam then data = 1 end
if getPlayerTeam ( thePlayer ) == PogotowieTeam then data = 2 end
if getPlayerTeam ( thePlayer ) == PDTeam then data = 3 end
if getPlayerTeam ( thePlayer ) == TaxiTeam then data = 4 end
if getPlayerTeam ( thePlayer ) == PetrolTeam then data = 5 end
if getPlayerTeam ( thePlayer ) == FreshLogisticTeam then data = 6 end
if getPlayerTeam ( thePlayer ) == TarTexTeam then data = 7 end
if getPlayerTeam ( thePlayer ) == SlCompanyTeam then data = 8 end
end
if j == #DanePostacie then
String = String..""..DanePostacie[j].."='"..data.."'"
else
String = String..""..DanePostacie[j].."='"..data.."', "
end
end
mysql_query(handle, "UPDATE MTATS_postacie SET "..String.." WHERE id = "..postacID.."")
mysql_query(handle, "UPDATE MTATS_postacie SET loged=0 WHERE id = "..postacID.."")
local String = nil
end
end
end

function loadStats(thePlayer)
local postacID = getPlayerID(thePlayer)
local result = mysql_query(handle,"SELECT * FROM MTATS_postacie WHERE id = "..postacID.."")
if result then
setElementData(thePlayer,"loged",1)
for i,v in mysql_rows(result) do
for j=2,#DanePostacie do
setElementData(thePlayer,DanePostacie[j],v[j],true)
if DanePostacie[j] == "frakcja" then
if tonumber(v[j]) == 0 then setPlayerTeam ( thePlayer, KierowcyTeam ) end
if tonumber(v[j]) == 1 then setPlayerTeam ( thePlayer, PolicjaTeam ) end
if tonumber(v[j]) == 2 then setPlayerTeam ( thePlayer, PogotowieTeam ) end
if tonumber(v[j]) == 3 then setPlayerTeam ( thePlayer, PDTeam ) end
if tonumber(v[j]) == 4 then setPlayerTeam ( thePlayer, TaxiTeam ) end
if tonumber(v[j]) == 5 then setPlayerTeam ( thePlayer, PetrolTeam ) end
if tonumber(v[j]) == 6 then setPlayerTeam ( thePlayer, FreshLogisticTeam ) end
if tonumber(v[j]) == 7 then setPlayerTeam ( thePlayer, TarTexTeam ) end
if tonumber(v[j]) == 8 then setPlayerTeam ( thePlayer, SlCompanyTeam ) end
local r,g,b = getTeamColor(getPlayerTeam(thePlayer))
if tonumber(v[j]) ~= 1 then
createBlipAttachedTo(thePlayer, 0, 2, r, g, b, 255, 1,9999)
end
end
end
end
mysql_free_result(result)
setElementData(thePlayer,"czasToday",0)
mysql_query(handle, "UPDATE MTATS_postacie SET loged=1 WHERE id = "..postacID.."")
end
return true
end

function addHistory(thePlayer,co,gdzie,ile,wartosc,szczegoly)
if isElement(thePlayer) then
local frakcja = tonumber(getElementData(thePlayer,"frakcja"))
local ID = getPlayerID(thePlayer)
if ID and frakcja then
if frakcja >= 1 then
local tablename = nil
if frakcja == 1 then tablename = "policja"
elseif frakcja == 2 then tablename = "pogotowie"
elseif frakcja == 3 then tablename = "pd"
elseif frakcja == 4 then tablename = "taxi"
elseif frakcja == 5 then tablename = "petrol"
elseif frakcja == 6 then tablename = "freshlogistic"
elseif frakcja == 7 then tablename = "tartex"
elseif frakcja == 8 then tablename = "slcompany"
end
if tablename then
local szczegoly = string.gsub(szczegoly,"?","e")
local szczegoly = string.gsub(szczegoly,"?","o")
local szczegoly = string.gsub(szczegoly,"?","a")
local szczegoly = string.gsub(szczegoly,"?","s")
local szczegoly = string.gsub(szczegoly,"?","l")
local szczegoly = string.gsub(szczegoly,"?","z")
local szczegoly = string.gsub(szczegoly,"?","z")
local szczegoly = string.gsub(szczegoly,"?","c")
local szczegoly = string.gsub(szczegoly,"?","n")
mysql_query(handle, "INSERT INTO MTATS_firmy_"..tablename.." (kiedy,kto,co,gdzie,ile,wartosc,szczegoly) VALUES ("..getRealTime().timestamp..","..ID..","..co..","..gdzie..","..ile..","..wartosc..",'"..szczegoly.."')")
end
end
end
end
end

function onPlayerExit()
saveStats(source)
for _, blip in ipairs(getElementsByType("blip")) do
if getElementAttachedTo(blip) == source then
destroyElement(blip)
end
end
end
addEventHandler("onPlayerQuit",gRoot,onPlayerExit)

function updatePlayerTime()
local players = getElementsByType("player")
for i,v in ipairs(players) do
local rtime = getElementData(v,"czasToday")
if rtime then
setElementData(v,"czasToday",tonumber(rtime)+1,true)
setElementData(v,"czasConverted",convertTime(tonumber(rtime)+1),true)
end
local tired = getElementData(v,"zmeczenie")
if tired then
if isPedInVehicle(v) then
setElementData(v,"zmeczenie",tonumber(tired)+0.02,true)
else
setElementData(v,"zmeczenie",math.max(0,tonumber(tired)-0.005),true)
end
end
end


for i,vehicle in ipairs(getElementsByType("vehicle")) do
local naczepa = getElementData(vehicle,"trailer")
if naczepa and isElement(naczepa) then
attachTrailerToVehicle(vehicle,naczepa)
end
end
end
setTimer(updatePlayerTime,1000,0)

function onKasaChange(dataName,oldValue)
if getElementType(source) == "player" then
if dataName == "kasa" then
setPlayerMoney(source,getElementData(source,"kasa"))
end
end
end
addEventHandler("onElementDataChange",gRoot,onKasaChange)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 11:05


Tostuch







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

Piwa: 137

Respekt: 110
Respekt: 110

Musisz poda? IP serwera MySQL, bo domy?lnie si? ??czy na "localhost" czyli lokalnym serwerze plik?w.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 11:46


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

a wiesz moze gdzie moge zobaczyc jakie ip ma MySQL ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 21:31


Tostuch







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

Piwa: 137

Respekt: 110
Respekt: 110

Sprawd? na hostingu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-24, 21:52


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Zwykle baza MySQL do??czana do serwer?w WWW ma ip wewn?trzne. Co znaczy, ?e nie uda Ci si? po??czy? z baz? na innym serwerze ni? serwer, na kt?rym stoi strona.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-25, 08:23


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Problem zosta? ju? naprawiony. Po??czy?em si? z inn? baz? danych :) .
Dzi?kuje wszystkim za pomoc temat do zamkni?cia.

Postaw piwo autorowi tego posta
 

 
Tagi: baza :: mysql
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Baza MySQL 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