Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Castillo

    Question

    If you're looking to make a camera like map editor's, then use the "freecam" resource.
  2. I think that function got removed, setVehicleHandling should do the same job though. function Break(player) if (not isPedInVehicle(player)) then return end local vehicle = getPedOccupiedVehicle(player) setVehicleHandling(vehicle, "brakeDeceleration", 0.08) end addCommandHandler ( "break", Break )
  3. You put this in a server-side script right? because handlingSetBrakeDeceleration is a server-only function. https://wiki.multitheftauto.com/wiki/Han ... celeration
  4. First, don't double post. Second, your script is wrong, your account name variable is "accName" and you're using "playerName" in isObjectInACLGroup (copied from the wiki). Third, you're checking in setElementSpeed function? that's really useless as you're also checking in turn function too.
  5. Bueh, intenta con esto: -- server side: addEventHandler("onPlayerWasted",root, function () local weapons = {} for index=0, 12 do local weapon = getPedWeapon(source, index) local weaponAmmo = getPedTotalAmmo(source, index) if tonumber(weaponAmmo) > 0 then weapons[weapon] = tonumber(weaponAmmo) end end local x, y, z = getElementPosition(source) spawnPlayer(source, x, y, z, 0, getElementModel(source)) for weapon, ammo in pairs(weapons) do giveWeapon(source, tonumber(weapon), tonumber(ammo), true) end end)
  6. function Break(player) if (not isPedInVehicle(player)) then return end local vehicle = getPedOccupiedVehicle(player) handlingSetBrakeDeceleration(vehicle, 0.08) end addCommandHandler ( "break", Break )
  7. function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end 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 ------ function turn(thePlayer) if not isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ( "Admin" ) ) then return end local vehicle = getPedOccupiedVehicle(thePlayer) if (not vehicle) then return end local rX, rY, rZ = getVehicleRotation(vehicle) local Speeds = getElementSpeed(vehicle, "mph") setElementRotation(vehicle, rX, rY, rZ + 180) local Boost = 0 -- You Can set this to 0 if You Dont Need it ! setTimer(setElementSpeed,50,1,vehicle,1,-Speeds+Boost outputChatBox("You turned your vehicle with " .. tostring(Speeds) .. " mph", thePlayer) end function bindTheKey() for index, player in pairs(getElementsByType("player")) do bindKey(player, "lctrl", "down", turn) outputChatBox("#00FF00You can press #0000FF'left ctrl' #00FF00in vehicle to turn for 180 degrees!", player, 255, 255, 255, true) end end addEventHandler("onResourceStart", resourceRoot, bindTheKey) addEventHandler("onPlayerJoin", root, function() bindKey(source, "lctrl", "down", turn) end)
  8. position x=10, position y=10, size width =20, size height=20 Change 10, 10 to 150, 130.
  9. 1: Postea tu sistema de respawn. 2: Talvez sea que tu PC no lo soporta.
  10. addEventHandler("onClientRender",root, function () dxDrawText("Your money: ".. tostring(getPlayerMoney(localPlayer)),10,10,20,20,tocolor(255,255,255)) end)
  11. 1: Depende de para que quieras usar el evento "onPlayerWasted", si no nos decis, no podemos ayudarte. 2: Intenta reducir la cantidad de zombies, talvez son demasiados.
  12. addEventHandler("onClientRender",root, function () dxDrawText(tostring(getPlayerMoney(localPlayer)),10,10,20,20,tocolor(255,255,255)) end)
  13. Of course it won't work, because you're creating GUI elements in a SERVER side script, GUI is ONLY client side. -- server side: function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then outputChatBox ( getPlayerName(source).." #00ff00has gotten the hunter! Run!", getRootElement(), 255, 255, 255, true ) triggerClientEvent("createHunterAlert",getRootElement()) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) -- client side: addEvent("createHunterAlert",true) addEventHandler("createHunterAlert",root, function () if isElement(label) then destroyElement(label) end local label = guiCreateLabel(10, 100, 150, 20, 'Hunter reached Run!', false) Animation.createAndPlay(label, Animation.presets.guiMove(100, 200, 2000)) Animation.createAndPlay(label, Animation.presets.guiFadeIn(2000)) end) -- meta.xml: "Hunter alert" description="hunter alert" author="~KaRLoS~" type="script" version="1.0"/>
  14. Castillo

    New Objects.

    You can't create your own object ID's If I'm right.
  15. Castillo

    Agua

    El map editor no tiene manera de crear agua (el agua donde nadas (https://wiki.multitheftauto.com/wiki/createWater)).
  16. Castillo

    .

    Eh, maybe he meant on Car locks, which can be found on Community: https://community.multitheftauto.com/index.php?p= ... ils&id=131 He clearly said "spawn lock", I guess he's looking for a spawn script that let's you block some spawns (e.g for Admins only). @dali: Check this out: https://community.multitheftauto.com/index.php?p= ... ls&id=1152 It doesn't has spawn blocking, but you could add it, or pay someone to do it for you.
  17. Castillo

    Mod Problem.

    function replaceModel() local col = engineLoadCOL('car/tube.col') engineReplaceCOL(col, 13637) txd = engineLoadTXD("car/tube.txd") engineImportTXD(txd, 13637) dff = engineLoadDFF("car/tube.dff", 0 ) engineReplaceModel(dff, 13637) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel) addCommandHandler ( "reloadcar", replaceModel )
  18. The element data is only saved on that element, if it's a player and he/she leaves the server, that element data is removed (because the player left). If it's on a object, when it get's destroyed, it'll be removed too.
  19. Castillo

    5000 posts!

    I would, but I've searched for life sellers in google and I couldn't find anything .
  20. I never had such problem Cadu12. @on-topic: You can put that code to see player money in the same script or in a different resource, wouldn't make difference.
  21. -- server side. exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") function win(ammo, killer, weapon, bodypart) local H = getElementData(killer, "EXP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) if killer and killer ~=source then setElementData(killer, "EXP", tonumber(H)+1) triggerClientEvent ( killer, "playSound" , killer ) if tonumber(H) == 30 then setElementData(killer, "Level", "Lvl 1 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 55 then setElementData(killer, "Level", "Lvl 2 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 75 then setElementData(killer, "Level", "Lvl 3 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 85 then setElementData(killer, "Level", "Lvl 4 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 95 then setElementData(killer, "Level", "Lvl 5 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 120 then setElementData(killer, "Level", "Lvl 6 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 150 then setElementData(killer, "Level", "Lvl 7 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 230 then setElementData(killer, "Level", "Lvl 8 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 350 then setElementData(killer, "Level", "Lvl 9 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 500 then triggerClientEvent ( killer, "playSound" , killer ) setElementData(killer, "Level", "Lvl 10 !") end outputChatBox(killer1 .. "Killed " .. noob .. " and gained +1 EXP", getRootElement(), 255, 255, 0, false) end end addEventHandler( "onPlayerWasted", getRootElement(), win) -- client side: addEvent ( "playSound" , true ) addEventHandler ( "playSound" , root , function() playSound ( "levelup.mp3" , false ) end)
  22. addCommandHandler("cash", function (thePlayer) local money = tonumber(getElementData(thePlayer,"data.money")) if (money) then outputChatBox("Your money is $".. tostring(money) .."!",thePlayer,0,255,0) end end)
  23. Do you know how this script works? this sets a ELEMENT DATA of money, it doesn't use the DEFAULT MTA money system.
  24. 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) CheckPlayer = executeSQLSelect ( "playerData", "serial", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "playerData", "'"..serial.."','0','0','0'" ) 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)
×
×
  • Create New...