Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. local text = guiGetText(myGUIElement)
  2. You're welcome. P.S: You meant "I owe you.", because "I own you." means that you're my owner (or something like that ).
  3. You're welcome.
  4. Just spent some time in the MTA wiki, I've learned most in there. https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI
  5. What do you mean? how did I make it? well, you can check what I'd.
  6. Well, you better start learning how to, right?
  7. ------------------------------------------------------------------------ --Copyright ©, Jesseunit --Please, do not Re-distribute ------------------------------------------------------------------------- local start = getTickCount(); local duration = 5000; local screenWidth, screenHeight = guiGetScreenSize(); local font = "bankgothic"; local scale = 2; local jij = getLocalPlayer() countMsg = { "Get ready for the countdown..." } local text = countMsg[#countMsg]; function addText(text) table.insert(countMsg, text) end addEvent("addTextdoor", true) addEventHandler("addTextdoor", root, function(text) addText(text) end ) function countRender() if stoprender == false then if not tickcount then tickcount = getTickCount () end if not alpha then alpha = 255 end local seconds = getTickCount() - tickcount alpha = alpha - (seconds / 200) alpha2 = alpha - 105 if alpha2 <= 0 then alpha2 = 0 end if alpha <= 0 then removeEventHandler("onClientRender", getRootElement(), countRender) alpha = 0 end else alpha2 = 150 alpha = 255 end local now = getTickCount() local time = now - start local width = dxGetTextWidth(text, scale, font) dxDrawRectangle(0, screenHeight-400.0, screenWidth, 50, tocolor(0, 0, 0, alpha2 or 150)) if (time > duration) then start = now text = countMsg[math.random(1, #countMsg)] return end local modi = duration - time dxDrawText(text, math.mod(modi, duration) / duration * (screenWidth + width) - width, screenHeight-408.0, 0, 0, tocolor(0, 161, 255, alpha or 255), scale, font) end function onClientRaceStateChanging ( newStateName, oldStateName) if oldStateName == "PreGridCountdown" then stoprender = true addEventHandler("onClientRender", getRootElement(), countRender) end if newStateName == "GridCountdown" then setTimer(function() stoprender = false end, 3500, 1) local x,y,z = getElementPosition(getPedOccupiedVehicle(jij)) timer1 = setTimer(setCameraMatrix, 6000, 1, x + 1, y + 4, z + 2, x, y, z, 10, 0) timer2 = setTimer(setCameraMatrix, 7000, 1, x + 5, y - 4, z + 4, x, y, z, 55, 0) timer3 = setTimer(setCameraMatrix, 8000, 1, x - 3, y + 5, z + 3, x, y, z, 21, 0) timer4 = setTimer(setCameraTarget, 9000, 1, jij) end if newStateName == "Running" then setCameraTarget(jij) end end addEvent( "onPlayersReady", true ) addEventHandler( "onPlayersReady", getRootElement(), onClientRaceStateChanging ) function restartMap() killTimer(timer1) killTimer(timer2) killTimer(timer3) end addCommandHandler("redo",restartMap)
  8. https://community.multitheftauto.com/index.php?p= ... ils&id=665 That's for normal races, maybe you can edit it to be on DM too.
  9. Errors? warnings? nothing??
  10. If I'm right, is not yet possible, it was planed for 1.1 but then they removed it due to bugs (I think).
  11. Benja, you've asked the same in the Spanish section, and I've gave you the same link. I think you don't understand something, jobs are like any other script, you decide how to make them, or do you think there's a magic program that creates the jobs?
  12. -- client side: function me () GUIEditor_Window = {} GUIEditor_Image = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(370,249,635,331,"War_Script v1.0 By Evil-Cod3r",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(10,25,137,68,"images/1.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(16,107,137,24,"Health",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-bold-small") GUIEditor_Label[1] = guiCreateLabel(24,147,145,18,"Buy Health $ 1000",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Image[2] = guiCreateStaticImage(201,24,186,63,"images/2.png",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(211,109,166,26,"Armor",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(235,145,165,17,"Buy Armor $ 1500",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,255,255) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Image[3] = guiCreateStaticImage(424,22,182,70,"images/3.png",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(442,110,146,27,"invisible",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[3],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(449,148,133,13,"Buy invisible $ 2500",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Image[4] = guiCreateStaticImage(11,183,153,53,"images/4.png",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(14,249,136,26,"Barrel",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[4],"default-bold-small") GUIEditor_Label[4] = guiCreateLabel(19,286,136,18,"Buy Barrel $ 1800",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],0,0,255) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Label[5] = guiCreateLabel(137,-269,5,5,"",false,GUIEditor_Label[4]) GUIEditor_Image[6] = guiCreateStaticImage(431,178,172,63,"images/6.png",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(432,253,153,28,"JetPack",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[6],"default-bold-small") GUIEditor_Label[7] = guiCreateLabel(449,290,145,24,"Buy JetPack $ 1400",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[7],0,255,255) guiSetFont(GUIEditor_Label[7],"default-bold-small") outputChatBox("This Script By ||Evil-Cod3r||",255,255,0) outputChatBox("Press F3 To Open ||War_Shop Panel|| !!!",0,255,0) end addEventHandler("onClientResourceStart", resourceRoot, me) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent("buyHealth",localPlayer) elseif (source == GUIEditor_Button[2]) then triggerServerEvent("buyArmor",localPlayer) elseif (source == GUIEditor_Button[3]) then triggerServerEvent("buyinvisible",localPlayer) elseif (source == GUIEditor_Button[4]) then triggerServerEvent("buyBarrel",localPlayer) elseif (source == GUIEditor_Button[5]) then triggerServerEvent("buyJet",localPlayer) end end addEventHandler("onClientGUIClick",root,onGuiClick) function toggleMenu() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else guiSetVisible(GUIEditor_Window[1], true) showCursor(true) local sound = playSound("sounds/open.wav") setSoundVolume(sound, 8.5) end end bindKey("F3","down",toggleMenu) -- server side: addEvent("buyHealth",true) addEventHandler("buyHealth",root, function () if (getPlayerMoney(source) >= 1000) then setElementHealth ( source, 100 ) outputChatBox("You Have Bought (Health) !",source,255,255,0) outputChatBox("Your Health + 100", source, 255, 255, 0, true) takePlayerMoney(source, 1000) else outputChatBox("You don't have $1,000 to buy Health !",source,255,0,0) end end) addEvent("buyArmor",true) addEventHandler("buyArmor",root, function () if (getPlayerMoney(source) >= 1500) then setPedArmor ( source, 100 ) outputChatBox("You Have Bought (Armor) !",source,255,255,0) outputChatBox("+100 Armor Has Been Add To You !", source, 255, 255, 0, true) takePlayerMoney(source, 1500) else outputChatBox("You don't have $1,500 to buy Armor !",source,255,0,0) end end) addEvent("buyinvisible", true) addEventHandler("buyinvisible", getRootElement(), function() if ( getPlayerMoney (source) >= 2500 ) then takePlayerMoney(source, 2500) outputChatBox("You Have Bought (invisible) !", source, 255, 255, 0, true) outputChatBox("Others cant see you now For 6 Min !", source, 255, 255, 0, true) setElementAlpha(getPedOccupiedVehicle(source),0) setElementAlpha(source,0) setPlayerNametagShowing(source, false) setTimer( setElementAlpha, 60000, 1, source, 500, true) setTimer( setElementAlpha, 60000, 1, getPedOccupiedVehicle(source), 500, true) setTimer( setPlayerNametagShowing, 60000, 1, source, true, true) else outputChatBox("You don't have $1,500 to buy invisivle !", source, 255, 0, 0, true) end end ) addEvent("buyBarrel",true) addEventHandler("buyBarrel",root, function () if ( getPlayerMoney (source) >= 1800 ) then takePlayerMoney(source, 1800) local x,y,z = getElementPosition( source ) createObject ( 1225, x, y, z, 90, 0, 0 ) outputChatBox("You Have Bought (Bareel) !", source, 255, 255, 0, true) outputChatBox("Bareel Successfully droped", source, 255, 255, 0, true) else outputChatBox("You don't have $1,800 to buy Bareel !", source, 255, 0, 0, true) end end ) addEvent("buyJetPack",true) addEventHandler("buyJetPack",root, function () if ( getPlayerMoney (source) >= 1400 ) then takePlayerMoney(source, 1400) givePedJetPack(source) outputChatBox("You Have Bought (JetPack) !", source, 255, 255, 0, true) else outputChatBox("You don't have $1,400 to buy JetPack !", source, 255, 0, 0, true) end end )
  13. function creatingTables() exports.scoreboard:addScoreboardColumn("Cash") executeSQLCreateTable("playerData", "serial STRING, Cash INT, DMAttempts INT, DDAttempts INT") outputChatBox("Cash System by KHD started.") for index, player in ipairs(getElementsByType("player")) do addAccountIfNotExists(player) end end addEventHandler("onResourceStart", resourceRoot, creatingTables) function addAccountIfNotExists(player) local serial = getPlayerSerial(player) local CheckPlayer = executeSQLSelect ( "playerData", "*", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "playerData", "'"..serial.."','0','0','0'" ) else local Cash = tonumber(CheckPlayer [1]["Cash"]) setElementData(source,"Cash", Cash) setElementData(source,"data.money",Cash,true) end end addEventHandler("onPlayerJoin",root,function () addAccountIfNotExists(source) end) function DestructionMoney(mapInfo,mapOptions,gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then for k,v in ipairs(getElementsByType("player")) do local serial = getPlayerSerial(v) local DDAttempts = executeSQLSelect ( "playerData", "DDAttempts","serial = '" .. serial .. "'") local DDAttempts = tonumber(DDAttempts[1]["DDAttempts"]) + 1 executeSQLUpdate ( "playerData", "DDAttempts = '"..DDAttempts.."'","serial = '" .. serial .. "'") setElementData(v,"data.DDAttempts",DDAttempts,true) end end end addEvent("onMapStarting") addEventHandler("onMapStarting", getRootElement(), DestructionMoney) function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Cash = executeSQLSelect ( "playerData", "Cash","serial = '" .. serial .. "'") outputChatBox("*Wins: "..playername.." took $"..get('MoneyForDD').." for winning the map!",getRootElement(),255,255,0) local Cash = tonumber(Cash[1]["Cash"]) + get('MoneyForDD') setElementData(thePlayer ,"Cash", Cash) setElementData(thePlayer ,"data.money",Cash,true) setElementData(thePlayer ,"data.playername",playername,true) executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end function hunterBonus(pickupID, pickupType, vehicleModel) if (info == "Destruction derby" and pickupType == "vehiclechange" and vehicleModel == 425) then local serial = getPlayerSerial(source) local Cash = executeSQLSelect ( "playerData", "Cash","serial = '" .. serial .. "'") local Cash = tonumber(Cash[1]["Cash"]) + 1000 outputChatBox("*Hunter: "..getPlayerName(source).." gets a $1000 hunter bonus!",source,25,125,225) setElementData(source ,"Cash", Cash) setElementData(source ,"data.money",Cash,true) executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterBonus)
  14. You're welcome.
  15. Castillo

    help

    function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end local parachute = createObject(3131, 0, 0, 0) function Break(thePlayer) if (not isPedInVehicle(thePlayer)) then return end local vehicle = getPedOccupiedVehicle(thePlayer) local handling = getVehicleHandling(vehicle) setElementData(vehicle, "slowing", vehicle) setVehicleHandling(vehicle, "brakeDeceleration", 20.08) setVehicleHandling(vehicle, "tractionMultiplier", 1.08) attachElements(parachute, vehicle, 0, -1.2, -0.1, 80, 0, 0) end addCommandHandler ( "break", Break ) function Breakoff(vehicle) local mph = getElementSpeed(vehicle, "mph") if (tonumber(mph) == 0) then local handling = getElementData(vehicle, "slowing") setVehicleHandling(vehicle, "brakeDeceleration", slowing) setVehicleHandling(vehicle, "tractionMultiplier", slowing) detachElements(parachute, vehicle) end end
  16. Castillo

    help

    It should detach it, not destroy it.
  17. No se, talvez puedas checkear cada dia?
  18. Castillo

    help

    That makes no sense, no offense but it has nothing to do with that. @joedajoester: Copy my code again, I found the error. P.S: It does say the line here.
  19. Castillo

    help

    I wonder some times if people is just stupid or just cannot think. How I'm supposed to fix it if you don't tell me in what line is the error...?
  20. Castillo

    help

    function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end local parachute = createObject(3131, 0, 0, 0) function Break(thePlayer) if (not isPedInVehicle(thePlayer)) then return end local vehicle = getPedOccupiedVehicle(thePlayer) local handling = getVehicleHandling(vehicle) setElementData(vehicle, "slowing", vehicle) setVehicleHandling(vehicle, "brakeDeceleration", 20.08) setVehicleHandling(vehicle, "tractionMultiplier", 1.08) attachElements(parachute, vehicle, 0, -1.2, -0.1, 80, 0, 0) end addCommandHandler ( "break", Break ) function Breakoff(vehicle) local mph = getElementSpeed(vehicle, "mph") if (tonumber(mph) == 0) then local handling = getElementData(vehicle, "slowing") setVehicleHandling(vehicle, "brakeDeceleration", slowing) setVehicleHandling(vehicle, "tractionMultiplier", slowing) detachElements(parachute) end end
  21. You can read the scripting introduction(s): https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI P.S: You may want to check this out: https://community.multitheftauto.com/index.php?p= ... ls&id=3224 maybe you can learn form it .
  22. Xeno, creating markers using a map file or via createMarker function is the same.
  23. I don't want to sound rude, but that's a mess, you should start with easier scripts if you are new.
  24. You're welcome .
  25. You're welcome .
×
×
  • Create New...