Jump to content

unknooooown

Members
  • Posts

    259
  • Joined

  • Last visited

Everything posted by unknooooown

  1. Okay. There are many ways to prevent this. The best way imo would be to: function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then outputChatBox ( getPlayerName(source).." #FF6464has gotten the hunter! Run!", getRootElement(), 255, 255, 255, true ) removeEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) -- NOTE THIS LINE THAT REMOVES THE EVENT HANDLER! end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) To make sure the eventHandler exists again for the next race, you could do. This would add the event everytime the resource / race is started. function enableHunterPickup() addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), enableHunterPickup) Telll me if you want another example. Oh yeah.. Another thing. You dont have to use ' getRootElement() ', ' root ' works just the same.
  2. Seems you are in way over your head Dev_Point Another thing.. Are you even sure that your script has access to ' "zombiegamemode.Reward" ' ? If I was you, I would shut down and delete this resource right away. If you want an experience/level system for your gamemode, I would recommend that you read how other people have done it in the past. Not just MTA players, but for all games that have those elements included. Could be games like World of Warcraft. There is TONS of info about the setup on the web.
  3. Do you only want this to happen to ONE hunter in the game or all of them? The info you are giving is very limited.
  4. I have to go now, but if noone else has helped you when I get back, I will have a look
  5. I am not totally sure about what you are trying to do, but try this: currentWindow = createWindow ( 300, 200, 400, 650, "Options" ) if currentWindow then destroyElement ( currentWindow ) end You should be able to see the changes yourself. Keep in mind that you cant check if something exists before it has been created. Well.. You can, but it wont do you any good
  6. That even helped me Thanks for pointing out those functions. Can't believe I havent noticed them before.
  7. I just tested the first script I gave you. There was a few errors in it, but it works. Server: function setPlayerAlphaProtectedVisible(enabled,source) if enabled == true then setElementAlpha ( source, 150 ) elseif enabled == false then setElementAlpha ( source, 255 ) end end function setPlayerProtected() triggerClientEvent(source,"enableClientPlayerProtection",source,true) setPlayerAlphaProtectedVisible(true,source) setTimer(setPlayerAlphaProtectedVisible,5000,1,false,source) end addEventHandler("onPlayerSpawn",root,setPlayerProtected) Client: function cancelDamageOnHurt() cancelEvent() end function enableClientPlayerProtection(enabled) if enabled == true then addEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) setTimer(enableClientPlayerProtection,5000,1,false) outputChatBox(getPlayerName(localPlayer) .. " is now spawnprotected ",0,153,0,true ) elseif enabled == false then removeEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) outputChatBox(getPlayerName(localPlayer) .. " is no longer spawnprotected ",0,153,0,true ) end end addEvent("enableClientPlayerProtection",true) addEventHandler("enableClientPlayerProtection",localPlayer,enableClientPlayerProtection) This example WILL work. Try and read it and understand it Dev_Point. EDIT: I'm very happy to hear you fixed it on your own! That's what I like to see from you Dev_Point You are getting better and better, so keep it up buddy.
  8. Where do you think that you should add it? I'm not gonna tell you exactly where it should be, because its so obvious. Tell me where you think it should be, and I will tell you if its correct.
  9. As Dev-Point said, you should use dxDrawText. https://wiki.multitheftauto.com/wiki/DxDrawText If you need any help with what you want, just ask us in here. I can imagine you want some random tips or a MOTD to be shows while people are downloading? You can either do (when download is hone) renderNeeded = true function renderTheText() if renderNeeded == true then dxDrawText( "BLAH BLAH BLAH", screenWidth/2, screenHeight/2, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown" ) end end or simply removeEventHandler("onClientRender", root, functionName) Hope that makes sense.
  10. What are you talking about? Did you even try it?
  11. Dev_Point. If you want to cancel damage on a player you need to cancel it clientside. You could do something like: Server: function setPlayerAlphaProtectedVisible(enabled) if enabled == true then setElementAlpha ( source, 150 ) elseif enabled == false then setElementAlpha ( source, 255 ) end end function setPlayerProtected() triggerClientEvent(source,"enableClientPlayerProtection",source,true) setPlayerAlphaProtectedVisible(true) setTimer(setPlayerAlphaProtectedVisible,5000,1,false) end addEventHandler("onPlayerSpawn",root,setPlayerProtected) Client: function cancelDamageOnHurt cancelEvent() end function enableClientPlayerProtection(enabled) if enabled == true then addEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) setTimer(enableClientPlayerProtection,5000,1,false) elseif enabled == false then removeEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) outputChatBox(getPlayerName(localPlayer) .. " is no longer spawnprotected ",0,153,0,true ) end end addEvent("enableClientPlayerProtection",true) addEventHandler("enableClientPlayerProtection",localPlayer,enableClientPlayerProtection) NOTE: HAVENT TESTED IT! I expect that this would work, and it would protect the player for 5 secs every time he spawns. You could add some checks to disable this for some players. Feel free to use this and develop it further if you can use it.
  12. You do realize that you change the model and texture of the same element three times right?
  13. Could you post the code you use to replace the object and texture?
  14. unknooooown

    help me

    No problem Hope it helped you. If not, then feel free to ask again We are here to help.
  15. Aw! I thought I was being very creative! Hope you notice the message: ' In case you didnt notice the sarcasm.. THIS IS A JOKE! '
  16. Forget everything about all existing resources! The best resource of all time is finally ready! Released code: addCommandHandler("give_me_a_penis",function(player) local x,y,z = getElementPosition(player) local mahPenis = createObject(321,x,y,z) setElementCollisionsEnabled(mahPenis ,false) attachElements(mahPenis ,player,0.03,0.2,-0.45,0,0,90) end) Screenshot: http://i.imgur.com/T7oxH.png In case you didnt notice the sarcasm.. THIS IS A JOKE!
  17. unknooooown

    help me

    I dont see a problem with the timer. But to prevent the server from doing too much work you could use these changes. NB: Read the comments in the script. function cambiabuffalo () for i,v in ipairs(getElementsByType("vehicle")) do local handlingSet = getElementData(v,"handlingSet") -- We use this to check if the current vehicle 'v' has changed handling if handlingSet ~= true then -- If the handling has not been changed yet, then it will change it. if getElementModel(v) == 402 then --buffalo setVehicleHandling(v, "mass", 1059.9) setVehicleHandling(v, "turnMass", 4099.9) setVehicleHandling(v, "dragCoeff", 2.0) setVehicleHandling(v, "centerOfMass", {0.0, 0.1, -0.48} ) setVehicleHandling(v, "percentSubmerged", 75) setVehicleHandling(v, "tractionMultiplier", 0.70) setVehicleHandling(v, "tractionLoss", 0.80) setVehicleHandling(v, "tractionBias", 0.47) setVehicleHandling(v, "numberOfGears", 5) setVehicleHandling(v, "maxVelocity", 350) setVehicleHandling(v, "engineAcceleration", 55.0) setVehicleHandling(v, "engineInertia", 5.0) setVehicleHandling(v, "driveType", "rwd") setVehicleHandling(v, "engineType", "petrol") setVehicleHandling(v, "brakeDeceleration", 8.0) setVehicleHandling(v, "brakeBias", 0.45) setVehicleHandling(v, "ABS", true) setVehicleHandling(v, "steeringLock", 55.0) setVehicleHandling(v, "suspensionForceLevel", 1.4) setVehicleHandling(v, "suspensionDamping", 0.15) setVehicleHandling(v, "suspensionHighSpeedDamping", 0.0) setVehicleHandling(v, "suspensionUpperLimit", 0.28) setVehicleHandling(v, "suspensionLowerLimit", -0.05) setVehicleHandling(v, "suspensionFrontRearBias", 0.5) setVehicleHandling(v, "suspensionAntiDiveMultiplier", 0.3) setVehicleHandling(v, "seatOffsetDistance", 1.25) setVehicleHandling(v, "collisionDamageMultiplier", 0.10) setVehicleHandling(v, "monetary", 35000) setVehicleHandling(v, "modelFlags", 0xc0000000) setVehicleHandling(v, "handlingFlags", 0x01780002) setVehicleHandling(v, "headLight", 1) setVehicleHandling(v, "tailLight", 1) setVehicleHandling(v, "animGroup", 1) setElementData(v,"handlingSet",true) -- Let the server know that this vehicle has been changed, so it wont do it again next time. end end end end addEvent( "handlingcambiato", true ) addEventHandler ( "handlingcambiato", getRootElement(), cambiabuffalo ) setTimer ( cambiabuffalo, 1000, 0) To prevent the cars from being removed whenever you load a new resource, you could change: addEventHandler ("onClientResourceStart", getRootElement(), replaceModel) -- This is your line. addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()) , replaceModel) -- Replace it with this line. Notice that we dont use getRootElement() now. With getResourceRootElement(getThisResource()) it only triggers when THAT resource is started/restarted
  18. unknooooown

    help me

    Could you post the script you have got? Would be easier to help you if we can see what you are working on.
  19. No problem Hope my answer could help you.
  20. GUIEditor_TabPanel[1] = guiCreateTabPanel(409,174,551,400,false) Add a parrent to make it stick. https://wiki.multitheftauto.com/wiki/GuiCreateTabPanel
×
×
  • Create New...