Jump to content

FlorinSzasz

Members
  • Posts

    145
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by FlorinSzasz

  1. Well we get the elementType of the hitElement if u look on wiki the event onMarkerHit has a element asked by function that is hitElement which is the element that hits the marker so we check if a player hits the market and nothing else.
  2. Well first you should to this addEventHandler("onMarkerHit", moneyOne, function(hitElement) local elementType = getElementType(hitElement) local thePlayer = hitElement if elementType == "player" then --- your code end end) addEventHandler("onMarkerHit", moneyTwo, function(hitElement) local elementType = getElementType(hitElement) local thePlayer = hitElement if elementType == "player" then --- your code end end) it should work i didn`t test it
  3. local bomb = createObject(935,x,y,z) local a = createMarker(x,y,z,"checkpoint",2.5) function MarkerHit ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer and source == a then if isElement(bomb) then destoryElement(bomb) bomb = nil end end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )
  4. Well u should destroy the element and set it to nil when u hit the marker.
  5. my mistake we need a variable local hp_armor if armour > 0 then hp_armor = dxDrawImage(x,y,w,h,"armor.png") else hp_armor = dxDrawImage(x,y,w,h,"health.png") end local hp local armour Also you keep this variables from last time just add the local hp_armor and replace the old lines with the new lines it should work.
  6. well for last picture where u talk about hud u need something like this, u just have to add this lines in your script local hp = getElementHealth(localPlayer) local armour = getPedArmor(localPlayer) if armour > 0 then -- draw armor img dxDrawImage(x,y,w,h,"armour.png") -- write the image name and extension and location u should have the image and the script in the same folder else --draw health image dxDrawImage(x,y,w,h,"health.png") end And for the part where u create a team u just write on a server side script local your_team_name = createTeam("Your team name",r,g,b) -- r,g,b your team color after name it should work i tried on the basic mta server it works. For the country part i dont know, i dont have experience with this, i hope someone better who knows will help you.
  7. Well you can use SetSkyGradient or a shader for the sky https://wiki.multitheftauto.com/wiki/SetSkyGradient Well about the clouds u can change the weather https://wiki.multitheftauto.com/wiki/Weather
  8. Nice one! Awesome job!
  9. Well the server/game has a lot of dimensions, i don`t remember for sure, but there are 100k dimensions or something like this on mta. U just set on server side the dimension of an element and u can change his dimension. All dimensions are empty they only have the world objects u can add more objects to them or cars etc just by creating the object and then just set his dimension.
  10. Well u can create a new variable that will be the money and save it to a database. And send data to client and show it in an inventory. Or u can get Player`s money and show it in your inventory or guiWindow.
  11. nice, i am not sure maybe the game does not load properly if u switch between maps i mean the vc one needs to be loaded and the old one unloaded if i remember correctly or something like that, and when u go back the game will not load properly the original map i think. I could be wrong also.
  12. 1. Please never use setElementData with things like money or health, armour on client side because i dont think it will sync with the server and the cheaters can inject data so they can change your values. 2. Also givePlayerMoney wont sync with the server so u have to use it server side. -- server side -- well also u can make a new event on server side createBank and trigger it on a button click or the way u want. i made a command for simple example. createBank = function(player,commandName) if getElementData(player,"bank") == true or getElementData(player,"bank") >= 0 then outputChatBox("[BANK] U have the bank created already",player) else outputChatBox("[BANK] New bank created!",player) setElementData(player,"bank",100) end end addCommandHandler("newBank",createBank,false,false) addEvent("withdrawMoney",true) withdraw = function(player,amount) if player == client then if amount ~= nil and amount > 0 then local current_data = getElementData(player,"bank") if current_data >= tonumber(amount) then setElementData(player,"bank",current_data - amount) givePlayerMoney(player,tonumber(amount)) else outputChatBox("[BANK] U dont have enough money for this tranzaction",player) end end end end addEventHandler("withdrawMoney",getRootElement(),withdraw) -- client side --1 remove givePlayerMoney --2 remove the line with setElementData -- now add this line in you function o outside local money_to_withdraw = 10 -- u can change the value the way u want -- and add in your funcion this triggerServerEvent("withdrawMoney",localPlayer,localPlayer,money_to_withdraw) i hope it helps the code is tested all u have to do is just add my code in your script where i told u to add it. Also u can use a guiCreateEdit on client side window and type the amount. https://wiki.multitheftauto.com/wiki/GuiCreateEdit https://wiki.multitheftauto.com/wiki/DgsCreateEdit and then get the input with https://wiki.multitheftauto.com/wiki/GuiGetText https://wiki.multitheftauto.com/wiki/DgsGetText
  13. Nici nu stiam ca esti de-al nostru, cand te-am vazut pe forum :))), oricum nice to see you here man!
  14. Numara cati jucatori sunt intr-o dimensiune function PlayersInDimension(dimension) local count = 0 local people = getElementsByType("player") for _,players in ipairs(people) do if getElementDimension(players) == tonumber(dimension) then count = count + 1 end end return count end
  15. ideea generala de la care am pornit era sa amplific culoarea la cer si sa fac un fel de filtru de culoare prin texturi -- faza cu amplificarea culorii cerului merge doar ca trebuie o distanta de randare mare ca altfel dispare textura din cadru si se vede cerul la culoarea originala -- filtrul de culoare meh e mai greu jocul percepe putin diferit textura fata de editor si se vede de parca am colorat ecranul si dupa am dat cu alb peste :)))
  16. E o textură,folosită cu functia de mai jos si cu o transparență mică - medie creată pe câteva straturi https://wiki.multitheftauto.com/wiki/DxDrawRectangle3D
  17. Mai jos sunt niste poze: https://ibb.co/fFJ8grk https://ibb.co/FzppzsK https://ibb.co/m9RsMKb https://ibb.co/4KQBK54
  18. Tested and works. Well here is the code: Server side -- replace the old function myskins with the new one i found some bugs in old one. --And then add the new event "ChangeSkin" function myskins(thePlayer,commandName) if thePlayer then local acc = getPlayerAccount( thePlayer ) local acc_name = getAccountName( acc ) local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=?",tostring(acc_name)) local rezult = dbPoll(q,-1) if #rezult > 0 then triggerClientEvent(thePlayer,"skin_inventory",thePlayer,rezult) end end end addCommandHandler("myskins",myskins,false,false) addEvent("ChangeSkin",true) change_skin = function(Player,skin) if source == Player and client == source then setElementModel(Player,skin) end end addEventHandler("ChangeSkin",getRootElement(),change_skin) Client side -- just replace all the code with this there are few changes but maybe u insert them wrong or not so u better replace all the code with this. function centerWindow (center_window) --- a function to put the window in the center of the screen local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return guiSetPosition(center_window, x, y, false) end addEvent("skin_inventory",true) -- we add the skin_inventory event client side so we can call it from server side function skin_inventory_gui(rezult) -- here we have our table sent from server to client skin_list = guiCreateWindow(329, 246, 465, 381, "MY SKINS", false) centerWindow(skin_list) guiWindowSetMovable(skin_list, false) guiWindowSetSizable(skin_list, false) skins = guiCreateGridList(9, 20, 376, 351, false, skin_list) guiGridListAddColumn(skins, "Description", 0.5) guiGridListAddColumn(skins, "Model/Skin Owned", 0.5) close = guiCreateButton(389, 20, 66, 21, "X", false, skin_list) set_skin = guiCreateButton(389, 40, 66, 21, "SET SKIN", false, skin_list) guiSetProperty(close, "NormalTextColour", "FFAAAAAA") showCursor(true) for key, value in ipairs(rezult) do -- we loop through table local row = guiGridListAddRow(skins) -- so for each result we get we insert a row with guiGridListSetItemText (skins, row, 1, "Skin Model ->", false, true) -- this value guiGridListSetItemText (skins, row, 2, value.skin, false, true) --- and skin model / id end addEventHandler ( "onClientGUIClick", close, closeinventory,false) -- event for close function and button!!! addEventHandler ( "onClientGUIClick", set_skin, closeinventory,false) -- event for set_skin button !!! end addEventHandler("skin_inventory",root,skin_inventory_gui) closeinventory = function(button,state) --- function to close the gui window and change the skin if (button == "left") and (state == "up") then if source == set_skin then if (guiGridListGetSelectedItem (skins)) then local skin_to_change = guiGridListGetItemText (skins, guiGridListGetSelectedItem (skins), 2) triggerServerEvent("ChangeSkin",localPlayer,localPlayer,skin_to_change) outputChatBox("[SKIN SYSTEM] You have changed your skin",160,255,160) end end showCursor (false) guiSetVisible(skin_list,false) end end
  19. that thing is not gta sa is just some wierd thing called gta sa.
  20. u can make a big gamemode with more minigames or split the gamemodes in dimensions one gamemode is in dimension 0 and another one is in 1 or 2 or etc u got my point i think.
  21. true, din obisnuinta fac așa :)))
  22. function find_value_in_table(table,value) local a = table for i=1,#a do if a[i] == value then return true end end end function find_value_pos_in_table(table,value) local a = table for i=1,#a do do if a[i] == value then local t = i return t end end end end 1.Prima functie este folosita la a verifica daca o valoare se afla sau nu intr-un tabel. 2.Urmatoarea functie folosita pentru a gasi pozitia (index-ul) unei valori intr-un tabel daca acea valoare exista in tabelul respectiv. *Sunt testate si merg.
  23. Corect așa fac in general cu task-urile zilnice însa aici am evitat asta cel mai probabil pentru ca mi se pare interesant să îți pui în practică ce faci pe hârtie. Ideea e că acum am schimbat abordarea și cred ca o să meargă în acest caz. ?
×
×
  • Create New...