Jump to content

arezu

Members
  • Posts

    446
  • Joined

  • Last visited

Posts posted by arezu

  1. like the debug says.. you are missing ")" here:

    addEventHandler("onPlayerJoin",getRootElement(),

    function()

    triggerClientEvent(source,"login",getRootElement())

    end

    ---

    add ')' after end.

  2. hard to say what it might be without seeing the script. if you keep checking the position of the ped, does it update? attached objects used to have issues with updating position.

    I tried removing attachElements and instead set the ped position over the vehicle so the ped stands on the roof.. but the same problem remains.

  3. are you just setting ped rotation, or are you setting their aim?

    also, it seems like peds are shooting the wrong direction somethimes because they twist at the waist, but the bullets still go the right way, is that what your seeing?

    Im setting both ped rotation and their aim, and yes, they twist the waist, but that doesn't change the direction the bullets go in.. because if i stay still, then their waist has the same rotation and the mullet has the same position as when accelerating.

    so the only thing that changes is the direction the bullets goes in when accelerating. (aiming direction is not controllable when i am accelerating)

  4. ok, thanks.. i hope it works well :)

    edit: it works perfectly :)

    edit2: i attached the ped to the vehicle before triggering the client event, and then also changing rotation of ped onClientRender and setAimTarget(theDude, getPositionOffset(vehicle, 0, 5000, 0))

    and getPositionOffset(vehicle, 0, 5000, 0) is a function i made and i get the position 5000 units in front of the vehicle.. it works and it shoots forward.. but when accelerate forwards, then the ped suddenly shoots in the opposite direction.. if i drive backwards then nothing like that happens..

    I tried to change the aim target to the opposite direction, and tried driving backwards, but there was no change. (only happens when accelerating forwards..).

    is there any way around this? i tried in mta 1.05 and 1.1

  5. When i create a ped and give it a weapon, and then i fire it, then it only fires for like 1 second and then it only shows the animation(doesn't give the effects of shooting).

      
    --server side 
    addCommandHandler("dude", 
    function(thePlayer) 
        local gunner = createPed(0, 0, 0, 0) 
        giveWeapon(gunner, 31, 999999999, true) 
        local posX, posY, posZ = getElementPosition(thePlayer) 
        setElementPosition(gunner, posX + 2, posY, posZ) 
        triggerClientEvent("onRequestStartBlabla", thePlayer, gunner) 
        outputChatBox("gunner!") 
    end) 
      
    --client side 
    local theDude = nil 
      
    function shooter() 
        if(theDude == nil)then return end 
        local vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
        if(vehicle == false)then return end 
        local isShooting = getControlState("vehicle_secondary_fire") 
        if(isShooting)then 
            setPedControlState(theDude, "fire", true) 
            outputChatBox("is shooting!") 
        else 
            setPedControlState(theDude, "fire", false) 
        end 
    end 
      
      
    addEvent("onRequestStartBlabla", true) 
    addEventHandler("onRequestStartBlabla", getRootElement(),  
    function(gunner) 
        theDude = gunner 
        addEventHandler("onClientRender", getRootElement(), shooter) 
    end) 
      
      
    

    i dont get any errors and i see the debug text i write in chatbox..

  6. After the moveObject function in your server sided script, add a triggerClientEvent to add onClientRender event for the player, clientsided. also add a setTimer after moveObject servesided to remove the event handler for the player.. so that the vehicle is not attached to the vehicle anymore...

    example:

      
    -- server sided 
    function moveLV ( ) 
     local car = getPedOccupiedVehicle ( source ) 
     local object = createObject ( 980, 0, 0, 3 ) 
        moveObject ( object, 10000, 0, 0, 6 ) 
    triggerClientEvent("onRequestChangeAttachementState", source, true, object) 
    setTimer(removeAttachement, 10000, 1, source) 
    end 
      
    function removeAttachement(thePlayer) 
    triggerClientEvent("onRequestChangeAttachementState", thePlayer, false) 
    end 
      
    --client sided 
    local attachSource = nil 
    addEvent("onRequestChangeAttachementState", true) 
    addEventHandler("onRequestChangeAttachementState", getRootElement(), 
    function(attach, theObject) 
    if(source ~= getLocalPlayer())then return end 
    attachSource = theObject 
    if(attach)then 
    addEventHandler("onClientRender", getRootElement(), attach) 
    else 
    removeEventHandler("onClientRender", getRootElement(), attach) 
    end 
    end) 
      
    function attach() 
    local vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
    if(vehicle == false)then return end 
    local posX, posY, posZ = getElementPosition(attachSource) 
    setElementPosition(vehicle, posX, posY, posZ) 
    end 
      
    

    i cant press tab here so it may be hard to read the code..

  7. if you cant move object when its attached, then you can use:

      
    addEventHandler("onClientRender", getRootElement(), 
    function() 
    local objX, objY, objZ = getElementPosition(theObject) 
    local vehicle = getPedOccupiedVehicle(theVehicle) 
    setElementPosition(theVehicle, objX, objY, objZ) 
    end) 
      
    

    ...instead of attachElements

    btw, am i the only on who cant tab here?

  8. Sorry for late response..

    You could either use getScreenFromWorldPosition two times, one for nametags and one for healthbar, or do the same thing i did by using dxGetFontHeight and for healthbar position y, using sy + fontHeight*(anynumber).

  9. I checked it fast so i dont really know if its right or not.. but i believe its from the sy-40 + offset in this:

    dxDrawText ( _getPlayerName(player), sx-30, sy-40 + offset, sx, sy, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default", "center", "bottom", false, false, false )

    so try this:

    dxDrawText ( _getPlayerName(player), sx, sy, g_screenX, g_screenY, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default", "center", "bottom", false, false, false )

    and see how it works.. and then edit your:

    local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )

    to change position of the nametags.

  10. you could create a marker and attach it to the plane for visual display, and then create an object, setElementCollisionsEnabled to false and setElementAlpha to 0 and attach it to the plane, and then use onClientRender to get distance between player and the object. and if within' range, then setElementInterior.

  11. recorded by |SW|Simon, intro by |SW|Blacktoaster..

    One part you didn't see in the video, is that there are 3 ways to go after the first teleport..and that it looks kinda different to the player playing.

    I dont like to make maps with only loops, wallrides, etc etc.. thats why i make random shietz with scripts.

  12. SERVER:

    Code: (lua)

    franceGol = createMarker ( 0, 0, 2.2164173126221, "cylinder", "7", 0, 255, 0, 255, getRootElement() ) 
    espagneGol = createMarker ( 50, 50, 2.2164173126221, "cylinder", "7", 0, 255, 0, 255, getRootElement() ) 
    balle = createObject ( 1305, 0, -10, 2.9733681678772) 
    setElementID( franceGol, "franceGol" ) 
    setElementID( espagneGol, "espagneGol" ) 
    setElementID( balle, "balle" ) 
      
    -- But 
    addEvent( "onPlayerGoal", true ) 
    function onPlayerGoal( equipe ) 
        ----------------- NE PAS TOUCHER ------------------------ 
        triggerClientEvent( "setGOAL", getRootElement() ) ------- 
        --------------------------------------------------------- 
        outputChatBox( equipe..": GOOOOOOOOOOOOOOOOL", getRootElement(), 255, 255, 0 ) 
        setTimer( playAgain, 4000, 1 ) 
    end 
    addEventHandler( "onPlayerGoal", getRootElement(), onPlayerGoal ) 
      
    function playAgain() 
        ----------------- NE PAS TOUCHER ------------------------ 
        triggerClientEvent( "resetGOAL", getRootElement() ) ----- 
        --------------------------------------------------------- 
        -- ceci est un exemple, à toi de le modifier comme bon te semble 
        setElementPosition( balle, 0, -10, 2.9733681678772 ) 
    end 
      
    

    CLIENT:( à ne pas toucher )

    Code: (lua) 
    GOAL = 0 -- GOAL évite le flood 
    function markerHIT() 
        local equipe 
        local balle = getElementByID( "balle" ) 
        local marker = getElementByID( "franceGol" ) 
        local marker2 = getElementByID( "espagneGol" ) 
        local bool = isElementWithinMarker( balle, marker ) 
        local bool2 = isElementWithinMarker( balle, marker2 ) 
        if bool then equipe = "france" elseif bool2 then equipe = "espagne" end 
        if ( (bool or bool2) and GOAL == 0)then 
            GOAL = 1 
            triggerServerEvent( "onPlayerGoal", getLocalPlayer(), equipe ) 
        end 
    end 
    setTimer( markerHIT, 500, 0 ) 
      
    addEvent("resetGOAL", true ) 
    function resetGOAL() 
        GOAL = 0 
    end 
    addEventHandler("resetGOAL", getRootElement(), resetGOAL ) 
      
    addEvent("setGOAL", true ) 
    function setGOAL() 
        GOAL = 1 
    end 
    addeventHandler("setGOAL", getRootElement(), setGOAL ) 
    

    "Unfortunately this idea won't work since the ball isn't synchronized between players. It will end up in a different place on everyone's screen."

    written by a super moderator long ago, but its still the same. It doesn't work.

×
×
  • Create New...