Jump to content

βurak

Members
  • Posts

    376
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by βurak

  1. function spawnItemsWhenStart ( name ) createPed(287, 1544.75390625, -1675.2421875, 13.55902671814, 90) end addEventHandler ( "onResourceStart", getResourceRootElement(), spawnItemsWhenStart ) function spawnMarkerFunction() --local deleteMarker = createMarker(1529.248046875, -1685.935546875, 4.5, "cylinder", 3, 135, 15, 15, 0) setElementInterior(spawnMarker, 0) setElementDimension(spawnMarker, 0) addEventHandler("onMarkerHit",spawnMarker,onSpawnMarkerHit) end spawnHeliMarker = createMarker (1930.0791015625, -2626.673828125, 12.5, "cylinder", 3, 122, 193, 67, 70) function onSpawnHeliMarkerHit (thePlayer, hitElement, heliSpawnPos) if(getElementType(hitElement) ~= "player") then --If hitElement is not a player, go no further return end local money = getPlayerMoney(hitElement) if (money < 10000) then --if the player's money is less than 10000 go no further outputChatBox("You don't have enough money!", hitElement, 255, 0, 0) return end outputChatBox("You purchased a blackhawk!", hitElement, 0, 255, 0) takePlayerMoney(hitElement, 10000) local heliSpawnPos={ {1967.8515625, -2636.1103515625, 13.546875}, {1998.966796875, -2636.849609375, 13.546875}, } local theVeh = getPedOccupiedVehicle(hitElement) if ( theVeh ) then if ( VehiclesTable[hitElement] ) then VehiclesTable[hitElement] = nil end return end local x, y, z = getElementPosition (hitElement) local rotX, rotY, rotZ = getElementRotation (hitElement) local random = math.random(1,#heliSpawnPos) VehiclesTable[hitElement] = createVehicle (563, heliSpawnPos[random][1], heliSpawnPos[random][2], heliSpawnPos[random][3]+2) setElementRotation (VehiclesTable[hitElement], rotX, rotY, 0) warpPedIntoVehicle (hitElement, VehiclesTable[hitElement]) end addEventHandler("onMarkerHit", spawnHeliMarker, onSpawnHeliMarkerHit) can you try this? You didn't say what getElementData means so I deleted that
  2. What data do you want to get with getElementData?, can you show line 90? by the way this line should be above the if code local money = getPlayerMoney(hitElement)
  3. there is an error here money must be a string tonumber(getElementData(hitElement, money)) change it like this tonumber(getElementData(hitElement, "money"))
  4. kodu gösterirsen belki yardımcı oluruz kodsuz kimse yardım edemez
  5. yes there must be something wrong with this link because it was working yesterday, now it's not working can you try to download it via archived website https://megalodon.jp/2022-0315-0707-50/bpb-team.ru/star-tR/files/maps.zip
  6. There's something here but I'm not sure if that's what you want http://bpb-team.ru/star-tR/files/maps.zip
  7. I'm not sure but can you try this code this is a bit different from the math you use local screenW, screenH = guiGetScreenSize() local myW, myH = 1920, 1080 -- your resolution here local relX, relY = (screenW/myW),(screenH/myH) --this dxDrawText("Password", screenW * 0.4844, screenH * 0.5093, screenW * 0.5188, screenH * 0.5222, tocolor(255, 255, 255, 255), 1.00 * relX, "default", "left", "top", false, false, false, false, false)
  8. server sana ait ise kodu gösterirmisin? eğer değilse server sahibi ile irtibat kurun bu sorun için script sonsuz döngüye giriyor olabilir
  9. You're welcome. Please open a new topic if you have any other questions, I'll help you as best I can. ?
  10. Are the function parameters correct? Is the function you called defined as exports in meta.xml? Are the function you call and the file you run the script on the same side?
  11. Can you try multiplying the size with screenW? --this dxDrawText("Password", screenW * 0.4844, screenH * 0.5093, screenW * 0.5188, screenH * 0.5222, tocolor(255, 255, 255, 255), screenW * 1.00, "default", "left", "top", false, false, false, false, false)
  12. There is no problem. Are you sure the font file is in the same folder as the script?
  13. actually you can solve this with a single variable instead of using "isEventHandlerAdded" Since there are more operations in the isEventHandlerAdded function, you can do it economically with a single variable. local isSpeedoMeterVisible = false --speedometer visibility status function hideSpeedometer() if(isSpeedoMeterVisible) then -- Is the speedometer visible? removeEventHandler("onClientRender", root, speedoMeterGUI) end end function showSpeedometer() if(isSpeedoMeterVisible == false) then -- Is the speedometer invisible? addEventHandler("onClientRender", root, speedoMeterGUI) end end ---------------------------------------------- function A1(player) vehicle = getPedOccupiedVehicle(player) if getPedOccupiedVehicleSeat(player)==0 or getPedOccupiedVehicleSeat(player)==1 then showSpeedometer() -------call to create the handler end end addEventHandler("onClientVehicleEnter", root, A1) function A2() hideSpeedometer() -----call to remove the handler end addEventHandler("onClientVehicleStartExit", root, A2)
  14. You can use a table for this, if you don't have very complex code on the client side, I strongly recommend using a table. example: local playerThings = {} -- storage place for player things function example(thePlayer, cmd) local thingCheck = playerThings[thePlayer] -- if player things are always going to be numbers then there is no need for "tonumber" --local thingCount = tostring(thingCheck) -- actually I think it is not needed because you convert it to string type with concatenation in outputChatBox function if (thingCheck and thingCheck >= 1) then outputChatBox("You have "..thingCheck.." thing(s).", thePlayer, 255,255,255) else outputChatBox("You don't have anything.", thePlayer, 255, 255, 255) end end addCommandHandler("mythings", example)
  15. the problem may be in the sql query so make sure this query is correct
  16. where the event is triggered before the resource starts on the client side or the use of the sql query may be wrong outputDebugString(sql.nivel) You can add a debug line inside the event to find out.
  17. You can create a client-side timer with setTimer, then use the triggerServerEvent as is so it will constantly update the level text (1 second may be enough for the update to avoid creating too many network connections) parameter of client side event "updateLevelPlayer"
  18. local sql = exports.sql:query_assoc_single("SELECT nivel FROM characters WHERE characterID = "..exports.players:getCharacterID(source)) I may have made a typo here, I fixed it, try this
  19. You can't do this on client side and I don't recommend doing it. it's good to stay on server side, use "triggerServerEvent" and "triggerClientEvent" to do this example: server: addEvent("requestGetLevelPlayer", true) --create event on server side addEventHandler("requestGetLevelPlayer", root, function() local sql = exports.sql:query_assoc_single("SELECT nivel FROM characters WHERE characterID=?"..exports.players:getCharacterID(source)) triggerClientEvent(source, "updateLevelPlayer", source, sql.nivel) --send level information to client end ) client: local level = 0 triggerServerEvent("requestGetLevelPlayer", localPlayer) --send level update request (don't use it in onClientRender) dxDrawText("LVL: "..level, x*2079, y*185, x*21, y*14, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false) addEvent("updateLevelPlayer", true) --event to update level addEventHandler("updateLevelPlayer", root, function(playerLevel) level = playerLevel --update level end )
  20. i tested now it uses texture named "sphere" but they use fxp files to create the effect I'm not sure you can do this in mta but you can find them in "effects.fxp" file
  21. if you want to run this event you can do it with setTimer For example you set the timer to 1 second, on the client side you then pass the triggerServerEvent to this timer this is better than calling it during every frame
  22. In fact, there is a very bad situation that I noticed in this resource, and that is this. Running triggerServerEvent per frame inside onClientRender event It will cause the server to consume a very large network connection and cause bad optimization of the server, so it is a very critical situation. so I suggest you delete this line function getCarStateColor(fuelVeh) --triggerServerEvent("verGasolina", localPlayer) -- <-- this if (fuelVeh) then local g = (255/100.0000) * fuelVeh local r = 255 - g local b = 0 return r, g, b else return 0, 255, 0 end end local csr, csg, csb = getCarStateColor() -- <-- this for fuel maybe you can use setElementData setElementData(veh, "Fuel", column["fuelofcar"]) --Create a key named "Fuel" and export the information from the database on client side use getElementData to get it getElementData(vehicle, "Fuel")
  23. getCarStateColor takes fuel parameter but no parameter in onClientRender event getCarStateColor(fuelVeh) local csr, csg, csb = getCarStateColor() maybe this issue can be fixed if you pass vehicle fuel status into onClientRender event
×
×
  • Create New...