Jump to content

Stevenn

Members
  • Posts

    97
  • Joined

  • Last visited

Posts posted by Stevenn

  1. yes, i forgot to add this. but this is what i got so far

    function createMarkerOnVehicleEnter () 
        if getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == myid then 
        triggerEvent ( "my event", localPlayer ) 
        end 
    addEventHandler ( "onClientVehicleEnter", root, createMarkerOnVehicleEnter ) 
    

  2. Hello, i got an question, i want when a client enters a vehicle, and if the vehicle id is a special one then it will trigger an event

    but im new to this kind of things and i don't know how to do it.

    could anyone help out with givng an example?

  3. how can I use it like this:

    if ( hitElement == localPlayer and source == cMarker and isTruck(lp) ) then  
    

    and

    function isTruck(lp) 
    if ( getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == 437 ) then 
    return true 
    end 
    end 
    

    or

    if ( hitElement == localPlayer and source == cMarker and ( getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == 437 ) ) then  
    

    none of them works, bad argument..

  4. ty it works draken, but how can I do this ?
    addEventHandler ( "onClientMarkerHit", cMarker , 
        function  ( ) 
            if getElementModel(getPedOccupiedVehicle(lp)) == 437 then 
                triggerServerEvent ( "busStop", lp ) 
            end 
        end 
    ) 
    

    bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]

    cMarker is not global. You must remove "local" before cMarker in the code to use it in other functions.

    See: http://en.wikipedia.org/wiki/Global_variable

    addEventHandler ( 'onClickCreateMarker', root, 
        function ( ) 
            local nX, nY, nZ     = getRandomLocation ( ); 
            cMarker        = createMarker ( nX, nY, nZ, "cylinder",4,250,250,255 ); 
            local blip           = createBlipAttachedTo ( cMarker, 53 ); 
        end 
    ) 
    addEventHandler ( "onClientMarkerHit", cMarker, 
        function  ( ) 
                triggerServerEvent ( "truckStop", localPlayer ) 
            end 
    ) 
    

    doesn't work...

  5. ty it works draken, but how can I do this ?

    addEventHandler ( "onClientMarkerHit", cMarker , 
        function  ( ) 
            if getElementModel(getPedOccupiedVehicle(lp)) == 437 then 
                triggerServerEvent ( "busStop", lp ) 
            end 
        end 
    ) 
    

    bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]

  6. i dont know what i am doing wrong

    bad argument @ 'createMarker'

    local locationTable = 
        { 
            { -2128, -80, 36 }, 
        } 
        
    function getRandomLocation ( ) 
        return unpack ( locations [ math.random ( #locationTable ) ] ) 
    end 
      
      
    function buttonClick(button) 
        if (button) ~= "left" then return end 
        if (source == acceptJob) then 
        triggerEvent ( "markerLocation3",lp ) 
            end 
    end 
    addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) 
         
    addEvent ( "markerLocation3", true) 
    function markerLocation () 
            markerLocation2 = createMarker ( x, y, z, "cylinder",250,250,250 )  
            blip = createBlipAttachtedTo ( markerLocation2, 53 ) 
            end 
    addEventHandler("markerLocation3",root,markerLocation) 
             
    acceptJob = guiCreateButton(37,58,94,49,"Accept",false,truckWindow) 
    

    viewtopic.php?f=91&t=42187#p426764

  7. Thank you for the really fast reply, as always.

    But, if I'm gonna create a marker at one of those, how would I do that?

    outputChatBox ( "my message" ..locations.. "hehe" ) 
    mymarker = createMarker (locations, "cylinder", 1.5, 255, 255, 0, 170 ) 
      
    

    I'm probably wrong but.. :)

  8. local randomMoney = math.random ( 200, 500 ) 
    givePlayerMoney ( randomMoney ) 
    outputChatBox ( "well done you have earned ".. randomMoney .."$" ) 
    

    Oh, looks like I wasn't that gone after all, now, if I need to give the player a random location every time and then output in chatbox which location they got and create a marker at that

    I have absolutely no idea how to do it, and I'd appreciate some help

    like (i know this is obviously wrong)

      
    outputChatBox("Now depart to" ..location.. "to get your next pay") -- where location will be randomly choosen from a table (x,y,x) and a name attached to it, like 
    location = { [jefferson]=x,y,z, [allsaints]=x,y,z 
    

  9. Okay so, im trying to do a job, but i need to know can i give a player a random pay, should i use math.random or random from a table?

    like

    givePlayerMoney(math.random (200, 500)) 
    

    would give the player a random pay from 200-500? and, if i use any of those alternative how can I output it in chatbox like

    givePlayerMoney(math.random (200, 500)) 
    outputChatBox("well done you have earned" ..what_to_pu_here.. "$") 
    

  10. function dxText ( ) 
        dxDrawText("my message",511.0,354.0,995.0,637.0,tocolor(255,255,255,255),1.5,"pricedown","left","top",false,false,false) 
    end 
      
       
    addEventHandler('onClientResourceRoot', root, 
        function(reason) 
            addEventHandler ( "onClientRender", root, dxText ) 
            setTimer ( 
                function ( ) 
                    removeEventHandler ( "onClientRender", root, dxText ) 
                end 
                ,5000,1 
            ) 
        end 
    ) 
    

    no debugs, but no message either.

  11. That's because every time you join, you download the client side resources and that triggers "onClientResourceStart".

    oh, is it possible to not make it trigger?

    try this:

    addEventHandler ( "onClientPlayerJoin", root,function( ) 
        sound = playSound ("files/mission.mp3", false ) 
        setSoundVolume ( sound, 1.0 ) 
    end) 
    

    wouldn't that specifically play the sound when i join? i want it to only play when i restart the resource.

×
×
  • Create New...