Jump to content

Zielony745

Members
  • Posts

    12
  • Joined

  • Last visited

Zielony745's Achievements

Square

Square (6/54)

0

Reputation

  1. Nawet nie pomyślałem o tym Jeszcze raz dzięki bardzo.
  2. Dobra wszystko działa. Zrobiłem sobie jeszcze zmienną lokalną która formatuje liczbe do stringu i tak wygląda mój kawałek kodu. for _, v in ipairs( wyniki ) do local str = string.format("%d", v.uid) marker_create[str] = createMarker (v.x, v.y, v.z , v.type, v.size, v.r, v.g, v.b, v.a) total = total + 1 if marker_create[v.uid] then outputDebugString ( "Marker id: " .. v.uid .. " Wczytany!" ) else outputDebugString ( "Nie moge wczytac do tablicy: " .. v.uid ) end end Dziękuję ci bardzo za pomoc! Bo próbowałem wielu metod ale tutaj już nie wiedziałem co mam zrobić Jeszcze raz dzięki pozdrawiam.
  3. Dobra zastosowałem Output Debug String. Oto kod ServerSide: marker_create = {} function loadAllMarkers() total = 0 local query = string.format("SELECT uid, x, y, z, type, size, r, g, b, a, other_arg FROM gt_markers") local wyniki = exports.SQL:sql_getTableResult( query ) outputDebugString ( "Pobieram wszystkie markery" ) for _, v in ipairs( wyniki ) do marker_create[v.uid] = createMarker (v.x, v.y, v.z , v.type, v.size, v.r, v.g, v.b, v.a) total = total + 1 if marker_create[v.uid] then outputDebugString ( "Marker id: " .. v.uid .. " Wczytany!" ) else outputDebugString ( "Nie moge wczytac do tablicy: " .. v.uid ) end end --setTimer(reload_markers, 15*60*1000, 0) outputServerLog("Total markers: " .. total) end addEventHandler("onResourceStart", resourceRoot, loadAllMarkers) function test_marker( markerHit ) outputDebugString ( "Event Wywolany" ) if markerHit == marker_create[1] then outputDebugString ( "marker_create[1] dziala." ) else outputDebugString ( "marker_create[1] niedziala" ) end end addEventHandler("onPlayerMarkerHit", getRootElement(), test_marker) a to client-side GUIWyladuj = { tab = {}, progressbar = {}, tabpanel = {}, label = {}, button = {} } function showGuiRozladuj() GUIWyladuj.tabpanel[1] = guiCreateTabPanel(515, 235, 411, 430, false) GUIWyladuj.tab[1] = guiCreateTab("Informacje.", GUIWyladuj.tabpanel[1]) GUIWyladuj.button[1] = guiCreateButton(10, 35, 391, 54, "Rozładuj towar.", false, GUIWyladuj.tab[1]) addEventHandler("onClientGUIClick", GUIWyladuj.button[1], function() triggerServerEvent("rozladujTowar", getRootElement()) end) GUIWyladuj.label[1] = guiCreateLabel(139, 7, 134, 24, "Menu", false, GUIWyladuj.tab[1]) guiSetFont(GUIWyladuj.label[1], "clear-normal") guiLabelSetHorizontalAlign(GUIWyladuj.label[1], "center", false) guiLabelSetVerticalAlign(GUIWyladuj.label[1], "center") GUIWyladuj.progressbar[1] = guiCreateProgressBar(11, 99, 390, 52, false, GUIWyladuj.tab[1]) guiProgressBarSetProgress(GUIWyladuj.progressbar[1], 85) GUIWyladuj.label[2] = guiCreateLabel(10, 10, 370, 27, "Poziom załadowania towaru.", false, GUIWyladuj.progressbar[1]) guiSetFont(GUIWyladuj.label[2], "clear-normal") guiLabelSetColor(GUIWyladuj.label[2], 0, 0, 0) guiLabelSetHorizontalAlign(GUIWyladuj.label[2], "center", false) guiLabelSetVerticalAlign(GUIWyladuj.label[2], "center") GUIWyladuj.progressbar[2] = guiCreateProgressBar(11, 161, 390, 52, false, GUIWyladuj.tab[1]) guiProgressBarSetProgress(GUIWyladuj.progressbar[3], 85) GUIWyladuj.label[3] = guiCreateLabel(10, 10, 370, 26, "Waga towaru. (3000kg)", false, GUIWyladuj.progressbar[2]) guiSetFont(GUIWyladuj.label[3], "clear-normal") guiLabelSetColor(GUIWyladuj.label[3], 0, 0, 0) guiLabelSetHorizontalAlign(GUIWyladuj.label[3], "center", false) guiLabelSetVerticalAlign(GUIWyladuj.label[3], "center") GUIWyladuj.label[4] = guiCreateLabel(12, 221, 389, 175, "Informacje o towarze:\nKategoria: Towary Nie legalne\nTowar: Nielegalny\nblalblba\nxdw\ndsadsa", false, GUIWyladuj.tab[1]) guiLabelSetHorizontalAlign(GUIWyladuj.label[4], "center", false) guiLabelSetVerticalAlign(GUIWyladuj.label[4], "center") GUIWyladuj.button[2] = guiCreateButton(327, 161, 62, 14, "Zamknij", false, GUIWyladuj.label[4]) guiSetVisible(GUIWyladuj.tabpanel[1], false) addEventHandler("onClientGUIClick", GUIWyladuj.button[2], function() guiSetVisible(GUIWyladuj.tabpanel[1], false) showCursor( false ) end) end function GUIRozladuj( ) showGuiRozladuj() outputConsole("Gogogogo") guiSetVisible(GUIWyladuj.tabpanel[1], true) showCursor( true ) end addEvent("showGUIRozladuj", true) addEventHandler("showGUIRozladuj", getRootElement(), GUIRozladuj) addEvent("hideGUIZal_Wyl", true) addEventHandler("hideGUIZal_Wyl", getRootElement(), function() guiSetVisible(GUIWyladuj.tabpanel[1], false) showCursor( false ) end) function new3d_text( x, y, z, str ) local px,py,pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 150 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) if not sx then return end local scale = 1/(0.3 * (distance / 150)) local str = tostring( str ) dxDrawText ( str, sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "default", "center", "bottom", false, false, false ) end end addEventHandler("onClientRender",getRootElement(), function() new3d_text(2720.84375, -2405.4248046875, 10.4609375, "Strefa załadunku") new3d_text(2720.3291015625, -2504.177734375, 10.485120773315, "Strefa załadunku") end) A oto logi: [2014-02-08 16:44:27] INFO: Pobieram wszystkie markery [2014-02-08 16:44:27] INFO: Marker id: 1 Wczytany! [2014-02-08 16:44:27] INFO: Marker id: 2 Wczytany! [2014-02-08 16:46:44] INFO: Event Wywolany [2014-02-08 16:46:44] INFO: marker_create[1] niedziala
  4. I've tried but did not work table.insert I noticed that marker_create holds only in the loop and on the outside does not work ..
  5. Zrobiłem to inaczej teraz jest po stronie serwera lecz nie działa. Zero warrningów i errorów. function test_marker( markerHit ) if markerHit == marker_create[1] then outputConsole("Dziala") else outputConsole("Nie dziala") end end addEventHandler("onPlayerMarkerHit", getRootElement(), test_marker) W konsoli wyświetla mi się Nie działa ale marker widać --Jeszcze moge powiedzieć że gdy nie daje markerów w tablicy a z zmiennej to wszystko działa ale chciałbym aby dzialalo w tablicy.
  6. After taking the server side is still not working. But I did it so function test( markerHit ) if markerHit == marker_create[1] then outputChatBox("Good") else outputChatBox("Bad") end end addEventHandler("onPlayerMarkerHit", getRootElement(), test)
  7. Hey guys! I apologize in advance for my english .. Recently I decided to write a simple little script markers (markers in the game) in MySQL. Loading and Creating markers works but does not work Event who wants to perform namely in terms of: --client-side function test( ) outputChatBox("test") end addEventHandler("onClientMarkerHit", marker_create[1], test) And here I am loading markers and add them to the array. --server-side marker_create = {} local total = 0 function loadAllMarkers() total = 0 local query = string.format("SELECT uid, x, y, z, type, size, r, g, b, a, other_arg FROM markers") local wyniki = exports.SQL:sql_getTableResult( query ) for _, v in ipairs( wyniki ) do marker_create[v.uid] = createMarker (v.x, v.y, v.z , v.type, v.size, v.r, v.g, v.b, v.a) total = total + 1 end setTimer(reload_markers, 15*60*1000, 0) outputServerLog("Total markers: " .. total) end addEventHandler("onResourceStart", resourceRoot, loadAllMarkers) --This function also does not work function marker_link( uid ) local uid = tonumber(uid) if (marker_create[uid]) then return marker_create[uid] else outputServerLog("I can not get the link to the marker with id: " .. uid) end end In addition, I will add that the logs do not have any errors even with debugscript 3 Please help me. Yours Again, sorry for my english. I hope you understand what I wrote.
  8. Cześć. Ostatnio postanowiłem napisać sobie prosty skrypcik markerów(tych w grze) w MySQL. Ładowanie i Tworzenie markerów działa lecz nie działa mi Event który chce wykonać mianowicie chodzi o: --Kod ze strony klienta (client-side) function test( ) outputChatBox("test") end addEventHandler("onClientMarkerHit", marker_create[1], test) A tutaj mam wczytywanie markerów i dodawanie ich do tablicy. --Kod ze strony servera (server-side) marker_create = {} local total = 0 function loadAllMarkers() total = 0 local query = string.format("SELECT uid, x, y, z, type, size, r, g, b, a, other_arg FROM markers") local wyniki = exports.SQL:sql_getTableResult( query ) for _, v in ipairs( wyniki ) do marker_create[v.uid] = createMarker (v.x, v.y, v.z , v.type, v.size, v.r, v.g, v.b, v.a) total = total + 1 end setTimer(reload_markers, 15*60*1000, 0) outputServerLog("Total markers: " .. total) end addEventHandler("onResourceStart", resourceRoot, loadAllMarkers) --Użycie funkcji marker_link daje taki sam rezultat czyli nic function marker_link( uid ) local uid = tonumber(uid) if (marker_create[uid]) then return marker_create[uid] else outputServerLog("Nie moge uzyskac linku do markera o id: " .. uid) end end Dodatkowo dodam że w logach nie mam żadnych błędów nawet przy debugscript 3. Proszę o pomoc. Pozdrawiam
  9. How to fix it?? Heeeellllp
  10. How to fix it?? Heeeellllp
×
×
  • Create New...