-
Posts
53 -
Joined
-
Last visited
Everything posted by verona
-
Skrypt rozwożenia towarów/paczek.
verona replied to a topic in Pomoc ze skryptami i programowaniem w Lua
Forum jest od pomocy, nie gg. Łatwo znaleźć moje gg w necie - 5569666 -
Skrypt rozwożenia towarów/paczek.
verona replied to a topic in Pomoc ze skryptami i programowaniem w Lua
source = getLocalPlayer() function onresourceStart () outputChatBox("Skrypt wystartował",255,0,0) -- gui GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(131,55,586,509,"",false) GUIEditor_Button[1] = guiCreateButton(23,42,130,32,"Trociny 0 Pkt.",false,GUIEditor_Window[1]) addEventHandler( "onClientGUIClick", GUIEditor_Button[1], towarTrociny ) GUIEditor_Button[2] = guiCreateButton(18,383,550,54,"Zaladuj",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(130,454,332,46,"Zamknij",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) local markers = { { -1725, -121, 2 }, {-1854, 1402, 6.1}, {-2282, 2278, 4,5}, {-367, 1547, 75,1}, {345, 2534, 16,2}, {1641, 2412, 10}, {-2887, 503, 4}, {-1515, 721, 6}, {-683, 965, 12}, {948, 2279, 11}, {1488, 2146, 10}, {1910, 2157, 10}, {2242, 1977, 9}, {-658, 2318, 138}, {-2054, -2565, 30}, {-1416, -1468, 101}, {-605, -483, 25}, {-55, -326, 5}, {1077, -307, 75}, {-2644, 1334, 7}, {2481, 2796, 10}, {-857, -1944, 15}, {-87, -1574, 2}, {-2264, -1688, 480}, { -2029.1010742188, 172.45364379883, 27.35425567627 } } local pmoney = getPlayerMoney(source) points = getElementData(getLocalPlayer(), "Pkt") local vehicle_ids = {[524] = true, [578] = true, [403] = true, [514] = true, [414] = true, [515] = true, [440] = true, [455] = true} -- Cement Truck, DFT-30, Linerunner, Tanker, Mule, RoadTrain, Rumpo, Flatbed local dest = markers[math.random(1, #markers)] for k, v in ipairs (markers) do createMarker(v[1], v[2], v[3], "cylinder", 3, 255, 255, 0, 255) createBlip(v[1],v[2],v[3], 51) end local towar = 0 function towary(hitElement) local v = getPedOccupiedVehicle(hitElement) if v then if vehicle_ids[getElementModel(v)] then if towar == 0 and destblip ~= destmarker then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else rozladunek() end else outputChatBox("To nie jest pojazd dostawczy!", 0, 255, 0) end else outputChatBox("Aby załadować towar musisz mieć pojazd dostawczy!", 0, 255, 0) end end function rozladunek() if towar == 1 and destblip == destmarker then setElementData(source,"Pkt",tonumber(Pkt + 1)) rmoney = math.random(350,700) givePlayerMoney ( source, rmoney ) else outputChatBox("To nie jest ten rozładunek!", 0, 255, 0) end end function towarTrociny (player) if points >= 0 and towar == 0 then local towar = 1 outputChatBox("Załadowałeś trociny!", player) local destblip = createBlip( dest[1], dest[2], dest[3], 41, 2, 255, 255, 0, 0, 100) else outputChatBox("Aby załadować ten towar musisz mieć minimum 0 punktów!", 0, 255, 0) end end addEventHandler( "onClientMarkerHit", getRootElement(), towary ) Nie wszystko jest gotowe, bo nie rozumiem za bardzo logiki tego skryptu. Będziesz musiał do tego dojść sam, by działało tak jak zaplanowałeś w swojej głowie. Nie ma już błędów i waringów. Wykrywanie markera działa, i gdy wjade do niego tirem to wyskakuje "To nie jest ten rozładunek". Jeżeli to nie tak, to będziesz musiał pozmieniać kolejność w skrypcie. Co do poprawek to po prostu porównaj sobie twój skrypt i moje poprawki. Moim zdaniem zrobiłeś to za szybko. Skoro nie masz wprawy w lua, tak samo jak ja, to rób wszystko małymi krokami. Najpierw marker - sprawdzasz czy działa. Potem gui - sprawdzasz czy działa. I tak krok po kroku wszystko łączysz i rozbudowujesz. Tym sposobem będziesz miał jeden błąd do rozmyślania, a nie 5 za jednym zamachem.... Pozdrawiam PS czytaj dokładnie wiki i stosuj jej przykłady, bo moje poprawki polegały zwyczajnie na odwiedzeniu kilku podstron z danymi eventsami/funkcjami. -
Hi. I try use TriggerServerEvent. Client: function set_skin_id () triggerServerEvent ( "onSetSkin", getLocalPlayer(), 20 ) outputChatBox ( "test1" ) end Server: function SetSkinHandler ( skinid ) outputChatBox ( "Test: " .. skinid, source ) end addEvent( "onSetSkin", true ) addEventHandler( "onSetSkin", getRootElement(), SetSkinHandler ) When i start function set_skin_id, then chatbox print "test1", but not "Test: 20" (server function). I don't know why. No errors/warings in debug console. So what is bad? This is really simple script, but i try fix this in 3 hours! Regards.
-
Skrypt rozwożenia towarów/paczek.
verona replied to a topic in Pomoc ze skryptami i programowaniem w Lua
Specem od lua nie jestem, no ale postaram się pomóc. Takie błędy jak w linii 49 chyba wiesz skąd się biorą? Oczywiście z powodu odwołania do zmiennej która nie istnieje. Co do błędu z gui, to nie podoba mi się sposób stworzenia okienka. Radzę ci zrobić wszystkie elementy w funkcji, która będzie wywoływana przy onClientResourceStart. W tamtej twojej funkcji, nie tworzyć za każdym razem wszystkiego od nowa po najechaniu na marker, tylko zwyczajnie ustawić parametr visible okienka na true. Event z buttonem dodaj bezpośrednio pod linie gdzie tworzysz ten button, w tej samej funkcji. Nie dam głowy że to ma znaczenie, ale tak robili na wiki, tak robię ja, no i tak mi działa. Po za tym w towarTrociny widzę argument Player, a odwołując się do funkcji go nie przekazujesz. addEventHandler( "onClientMarkerHit", markers, towary() ) Czy zamiast "markers" nie powinno być getRootElement()? -
Skrypt rozwożenia towarów/paczek.
verona replied to a topic in Pomoc ze skryptami i programowaniem w Lua
Rozumiem, że sprawdziłeś waringi/errory w konsoli serwera ? -
pytałem o konsole serwera.....
-
Yes i know that, but hi need a money-script with database to edit them.
-
Gdzie pisze? A dać log z konsoli to już nie łaska?
-
Buy for what? Do you have a shop or other script like that in server? If not, then WTF?!
-
check console for warnings & errors
-
are you kidding me? we give you links and info because you are too lazy to use search, and you still please for links?!?!?
-
I really don't understand you. Ok You have own server for play with friends ya? You cant use other server to play with friends, if you cant configure own? You have FPS lags = you have slow computer! Go to setting and check all to minimum. You have ping lags = in own server this is impossible! If you have server in your own computer, then you connect to your server not with internet, but local (ping <10). If you have high ping in all servers, or if friends have lags in your server, then your internet connection is too bad to server hosting (upload and download speed is to slow). MTA have many many many servers, so chose one and play. Why you want to create own? If you really want own, fast server, then you have to pay for this in hosting company (you pay for slot)! But if you really want own server host in your PC, than check you internet speed on: http://www.speedtest.net/ or other site like this. PS don't send pm to me....
-
Its really simple 1. Open Map Editor and create New map. 2. Add object like wall, fence in hole. 3. Save map. 4. Restart server and load the resource in admin panel with name of you map. Done! You can also add your resource (map) to mtaserver.conf file to autostart. Regards
-
So you can have slow internet connection, thats why you have lags. Of course you have to turn off all internet application (like p2p and other).
-
MySQL Pobieranie wartości pola z tabelki.
verona replied to Azaroth's topic in Pomoc ze skryptami i programowaniem w Lua
a czy to pole w bazie mysql rzeczywiście zawiera jakąś wartość ? podaj swój kod to będzie łatwiej cokolwiek ustalić edit: i screen z phpmyadmina z twoją tabelą i rekordami -
Really good! 1# 9/10 2# 6/10 3# 9/10 Regards
-
If i understand - just edit a .png file in gamemode.
-
You are sure gamemode are started ;p ?
-
2 - open .lua file from this gamemode, find and delete line with this message Its really easy
-
game server in your computer or in hosting company (payable)?
-
MySQL Pobieranie wartości pola z tabelki.
verona replied to Azaroth's topic in Pomoc ze skryptami i programowaniem w Lua
Najpierw pobierasz rekord do zmiennej za pomocą mysql_query, sprawdzasz czy został pobrany poprawnie z wierszami za pomocą mysql_num_rows(zmienna_rekord), do jednej zmiennej przypisujesz ją używając mysql_fetch_assoc(zmienna_rekord) i już możesz w prosty sposób odwoływać się do poszczególnych pól (wierszy) za pomocą zmienna.nazwa_pola Mam nadzieję że pomogłem. Szczegóły i przykłady są na wiki. Pozdrawiam -
viewtopic.php?f=93&t=32245 viewtopic.php?f=93&t=43180 etc..... why you can't use google / forum search ?
-
Oh, ok you dont have time But you know what is wrong, and tell me? I should use newest commands, or what? Its very important for me
-
Hi. Sory for bad english. I download and running this script: https://community.multitheftauto.com/index.php?p= ... ils&id=811 Points works OK, but if i reconnect, then all stats going to 0. Why this cant save? In console: This is line 242: newData = tonumber(oldData[1]["RaceWins"]) + 1 And this is function: addEventHandler("onPlayerWasted",rootElement, function () setElementData(source,"Race Loses",tonumber(getElementData(source,"Race Loses"))+1) setElementData(source,"Points",tonumber(getElementData(source,"Points"))-2) local serial = getPlayerSerial(source) local oldData = executeSQLSelect( "RaceStats", "RaceLoses","serial = '" .. serial .. "'") newData = tonumber(oldData[1]["RaceWins"]) + 1 executeSQLUpdate ( "RaceStats", "RaceLoses = '"..newData.."'","serial = '" .. serial .. "'") end) I think problem is with SQL commands, but why? Where is this .db file? Maybe is this permission problem? Somebody can help me with this? PS Car color and lights is restarted in new map
-
Hi. Sorry i not speak English My GTA SA i great work, no problem, and MTA not work All versions... I Run MTA and white, white and menu mta is 100% ok. I findet server and connect. Loading is white, and server run and this: http://img801.imageshack.us/img801/3741/71925153.png What is this? Why GTA work and MTA dont work? I reinstall GTA, reinstall MTA, reinstall direx and graphic drivers and format Windows = nothing!!! Again this... How reapir this? GTA and other games working, only MTA not. My system: Windows XP SP3 Laptop: Toshiba Satellite L300 Pentium® Dual-Core CPU T4200 @ 2.00GHz 2.00 GHz, 2,87 GB RAM Mobile Intel® 4 Series Express Chipset Family Sorry for very bad English. Help me pleas!