Jump to content

Volltron

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by Volltron

  1. I'm trying to make the ped crawl from underground when it spawns, I'm using the timers to be able to change the animation and the animation speed since the climbing one is split. And I use setElementPosition to move the ped up so the next part of the climbing animation doesn't start in the same place as the first one. I'll try any recommendations, but I couldn't figure any other way of moving the ped up from under the ground while setting the climbing animation
  2. Hi, I was trying to make a script that spawns a ped underground and makes it crawl its way up, but the issue is that whenever the animation changes, it's not smooth, you can see the character glitching for a few frames. Code below: function spawnS(playerSource, commandName) local x, y, z = getElementPosition(playerSource) local sPed = createPed(19, x, y, z-2) setElementCollisionsEnabled(sPed, false) setTimer(function() setPedAnimation(sPed, "ped", "climb_pull",-1, false,true,false,false, 0, false) setTimer(setPedAnimationSpeed, 100, 1, sPed, "climb_pull", 0.4) setTimer(function() setElementPosition(sPed, x, y, z-1, true) setPedAnimation( sPed, "ped", "climb_stand", -1, false,false,false,false, 0, false) setTimer(function() setPedAnimationSpeed(sPed, "climb_stand", 0.5) setTimer(function() setElementCollisionsEnabled(sPed, true) setElementPosition(sPed, x, y, z, true) setPedAnimation( sPed, "ped", "climb_stand_finish", -1, false,true,false,false) end, 1400, 1) end, 100, 1) end, 2000, 1) end, 100, 1) end addCommandHandler("s", spawnS) Is there any way of achieving this ?
  3. I want to create a custom radar on which I can add blips and radarareas but I can't even get near that since I'm having trouble with the math, this is what I did so far -- Removing the hud radar -- local function hideRadar() setPlayerHudComponentVisible("radar", false) end addEventHandler("onClientResourceStart",resourceRoot,hideRadar) -- GPS -- local screenW, screenH = guiGetScreenSize() local mapImgWidth, mapImgHeight = 3072 , 3072 -- size of the world.jpg texture local minimapX, minimapY = 696, 364 -- test size of the radar local rt = dxCreateRenderTarget(541, 454) addEventHandler("onClientRender", root, function() local x, y = getElementPosition(getLocalPlayer()) -- player x, y coords local camX, camY, camZ = getElementRotation(getCamera()) -- player x, y ,z camera coords local plRotX, plRotY, plRotZ = getElementRotation(getLocalPlayer()) -- player rotation coords local minimapW, minimapH = dxGetMaterialSize(rt) dxSetRenderTarget(rt,true) dxDrawImageSection(0, 0, mapImgWidth, mapImgHeight, 0, 0, mapImgWidth, mapImgHeight, ":gps_remake/images/world.jpg") dxDrawImage(minimapW/2 - 30/2, minimapH/2 - 30/2, 30, 30, ":gps_remake/images/player.png", camZ- plRotZ) dxSetRenderTarget() dxDrawImage(minimapX, minimapY, minimapW, minimapH, rt); end ) How do I show the player location with the dxDrawImageSection
  4. I know, I've looked at it before this but it's not what i was looking for. I fixed it anyway by making an empty sniper scope with no crosshair and added a crosshair over it
  5. Same thing happens, but thank you anyway. I think there's just no way of getting rid of the black side bars when zooming in with the sniper
  6. Yes that's what I tried but the problem is the black bars and I was wondering if there's any way of just getting rid of them or if I have to get used to that and work with it https://i.imgur.com/2Vgw4w8.png
  7. I'm trying to change the whole sniper crosshair and scope but I get black bars instead of an empty screen when i aim with sniper Is there any way i can get rid of the black bars ? local shader = dxCreateShader("textureS.fx"); local texture = dxCreateTexture("empty.png"); dxSetShaderValue(shader, "crosshair_sniper", texture); engineApplyShaderToWorldTexture(shader, "snipercrosshair"); engineApplyShaderToWorldTexture(shader, "cameracrosshair"); https://i.imgur.com/gwD8ovY.png
  8. I did it and now it works, thanks for help ^^ I also had to put the event handlers for colshapes inside the create function to make it work
  9. Im struggling with how to use the values without declaring them local outside the function function createTreasure() local treasureRadar = createRadarArea( treasurePositions[randomRadar][1] - 25, treasurePositions[randomRadar][2] - 25, 50, 50, 255, 221, 0, 100) local treasureArea = createColRectangle( treasurePositions[randomRadar][1] - 25, treasurePositions[randomRadar][2] - 25, 50, 50) local treasureObject = createObject(2060, treasurePositions[randomRadar].tabel[randomTreasure][1], treasurePositions[randomRadar].tabel[randomTreasure][2], treasurePositions[randomRadar].tabel[randomTreasure][3] - 1) local treasureCol = createColSphere(treasurePositions[randomRadar].tabel[randomTreasure][1], treasurePositions[randomRadar].tabel[randomTreasure][2], treasurePositions[randomRadar].tabel[randomTreasure][3] - 1, 1.5) attachElements(treasureCol, treasureObject) if (treasureObject) then setObjectScale (treasureObject, 2) end end addEventHandler("onResourceStart", getRootElement(), createTreasure) addEventHandler("onColShapeHit", treasureArea, function(thePlayer) if (getElementType(thePlayer) == "player") then setRadarAreaFlashing( treasureRadar, true ) end end ) addEventHandler("onColShapeLeave", treasureArea, function(thePlayer) if (getElementType(thePlayer) == "player") then setRadarAreaFlashing( treasureRadar, false ) end end ) addEventHandler("onColShapeHit", treasureCol, function(thePlayer) local detect = isElementWithinColShape (thePlayer, treasureCol) if detect then outputChatBox("Write /dig to dig", thePlayer, 255,255,255 ) end end ) function playerDigTreasure(thePlayer, command) local detect = isElementWithinColShape (thePlayer, treasureCol) if detect then setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, nil, false); setTimer( function() givePlayerMoney( thePlayer, 100000) destroyElement(treasureObject) destroyElement(treasureCol) destroyElement(treasureArea) destroyElement(treasureRadar) outputChatBox("Next treasure spawning in 5 seconds", getRootElement(), 255,255,255 ) setTimer(createTreasure, 5000, 1) end, 2000, 1) end end addCommandHandler("dig", playerDigTreasure)
  10. Yes but i want to make it so it only activates when the vehicle is upside down, i've tried using "onClientVehicleDamage" and "onClientVehicleCollision" when the car is turned 180(upside down) but it doesn't seem to trigger it
  11. Is it possible to stop vehicles from catching fire when they're upside down ? And if so what functions could I use ?
  12. I made it by canceling event and then subtracting the loss value from the other value but I'm still wondering if it's possible doing it while vehicle is damage proof
  13. I'm trying to make a script where another value takes the damage the vehicle gets instead of the vehicle's hp and I wanted to know if it's possible to make it so the player can "deal damage" to the other value as long as the vehicle is in "setVehicleDamageProof, true"
  14. Thanks for that haha, you saved my ass
  15. Hello there again, I have a problem with my script. I want to make so when someone plays music in their car it will make others near hear it too but it doesn't start and I don't know what the problem is Client : local music = "blah.wav" function playTheSound(x, y, z, vehicle) sound = playSound3D(music, x, y, z) attachElements(sound, vehicle) setSoundMaxDistance(sound,50) setSoundVolume(sound,1) end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) stopSound(sound) end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) Server : function playMusic(thePlayer) if (isPedInVehicle(thePlayer)) then local x, y, z = getElementPosition(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else outputChatBox("You must be in a vehicle!", thePlayer, 0, 0, 255) end end addCommandHandler("start", playMusic) function stopMusic(thePlayer) triggerClientEvent("stopTheSound", root) end addCommandHandler("stop", stopMusic)
  16. Thanks, it works. The only problem is that anyone can write but only the admin sees what you write
  17. I wanted to make a script so that admins can chat between them function adminMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local tableadmin = { } if (isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) )) then table.insert(tableadmin,thePlayer) for i,admins in ipairs(tableadmin) do outputChatBox("#04B486[ADMIN-CHAT]"..name..": #FFFFFF"..message, admins, 255, 255, 255, true) end end end addCommandHandler("adminchat", adminMessage) I would really apreciate it if someone could help me
  18. can anyone please upload the MTA Script Editor setup ?
  19. The script itself actually works by changing the mta language but the language change command doesn't
  20. I did that and still showing english text when changing language
  21. Nope , it won't display the gui text now
  22. Hello guys ! Can someone help me with this script ? It is supposed to change the shop gui text to the chosen language but it only displays the english language local languageCode = getLocalization()["code"] function checkTheLanguage() if languageCode == "en_US" then languageCode = "en_US" elseif languageCode == "ro" then languageCode = "ro" else languageCode = "en_US" end end addEventHandler("onClientResourceStart",root,checkTheLanguage) local languageTable = { {"en","en_US"}, {"ro","ro"}, } function changeLanguageOnCommand(playerSource,language) if language then for i, lang in ipairs(languageTable) do if language == lang[1] then languageCode = lang[2] outputChatBox("New language: "..tostring(languageCode),0,255,0) end end else outputChatBox("Possible values for language: en, ro.",255,0,0) end end addCommandHandler("language",changeLanguageOnCommand) GUIEditor = { tab = {}, window = {}, tabpanel = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.34, 0.32, 0.36, 0.49, "SHOP", true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(0.01, 0.08, 0.97, 0.90, true, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab(LangTextTable[languageCode][1], GUIEditor.tabpanel[1]) GUIEditor.button[1] = guiCreateButton(0.06, 0.17, 0.10, 0.05, "xxx$", true, GUIEditor.tab[1]) GUIEditor.tab[2] = guiCreateTab(LangTextTable[languageCode][2], GUIEditor.tabpanel[1]) GUIEditor.button[2] = guiCreateButton(0.89, 0.04, 0.09, 0.05, "Close", true, GUIEditor.window[1]) end ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == GUIEditor.button[2]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) function shopwindow() guiSetVisible(GUIEditor.window[1], true) showCursor(true) end addCommandHandler("shop", shopwindow) addEvent("openShop",true) addEventHandler("openShop", getRootElement(), shopwindow) LangTextTable = { ["en_US"] = { "Medicine", "Weapons", }, ["ro"] = { "Medicina", "Arme", }, }
  23. Sigur gamemode-ul este luat de pe nu stiu ce site anonim si mai este si deschis de cineva care nu poate face o functie simpla asa ca o sa caute scripteri in schimbul adminului .Nu mai deschideti servere si invatati lua inainte.
×
×
  • Create New...