Jump to content

Perfect

Members
  • Posts

    563
  • Joined

  • Last visited

Posts posted by Perfect

  1. Try this one:

    local join = createMarker( -2975.974609375, 504.951171875, 1.3, "cylinder", 1.3, 255, 255, 0, 150) 
      
    function joinjob(localPlayer) 
    if (getElementType(localPlayer) == "player") and not ( isPedInVehicle( localPlayer ) ) then 
    triggerClientEvent (localPlayer,"pesquero",getRootElement(),localPlayer) 
    end 
    end 
    addEventHandler ("onMarkerHit", join, joinjob) 
      
    createBlip( -2975.974609375, 504.951171875, 2.4296875, 56, 3, 0, 0, 255, 255, 0, 250) 
      
    local Barcos = 
        { 
            [ 453 ] = true, 
            [ 453 ] = true 
        } 
    local BarcosSkins = 
        { 
            [ 210 ] = true, 
            [ 225 ] = true 
        } 
      
    local barcoTable = 
       { 
            { -3038.4482421875, 604.1875, -0.340974599123 }, 
            { -3095.3408203125, 766.5185546875, -0.31019884347916 }, 
            { -3161.6103515625, 903.453125, -0.35642492771149 }, 
            { -3094.2880859375, 998.7802734375, -0.32000458240509 }, 
            { -3027.7529296875, 922.7392578125, -0.34394550323486 }, 
            { -3041.1240234375, 856.3134765625, -0.3497366309166 }, 
            { -3053.4599609375, 750.5791015625, -0.33944514393806 }, 
            { -3045.521484375, 643.712890625, -0.375756919384 }, 
            { -3057.8583984375, 549.732421875, -0.36067345738411 }, 
            { -3143.16796875, 504.248046875, -0.39858004450798 }, 
            { -3198.35546875, 605.2978515625, -0.35631018877029 }, 
            { -3306.8505859375, 744.03125, -0.32741913199425 }, 
            { -3430.1376953125, 963.283203125, -0.37901026010513 }, 
            { -3384.814453125, 1068.4091796875, -0.32916113734245 }, 
            { -3278.1748046875, 1114.71875, -0.3424257338047 }, 
      } 
      
    function getRandombarcoTable ( ) 
        return unpack ( barcoTable [ math.random ( #barcoTable ) ] ) 
    end 
      
    function createbarcoTeam ( ) 
        theTeam = createTeam ( "Pesquero", 255, 255, 0 ) 
    end 
    addEventHandler ( "onResourceStart", resourceRoot, createbarcoTeam ) 
      
    function joinBarco( skin ) 
        setPlayerTeam ( source, theTeam ) 
        setElementModel ( source, skin ) 
        setElementData( source, "Occupation", "Fisherman", true ) 
        outputChatBox ( "aqui texto",source, 0, 255, 0 ) 
    end 
    addEvent ( "setBarco", true ) 
    addEventHandler ( "setBarco", root, joinBarco ) 
      
    function getNewBarcoLocation ( thePlayer ) 
        local x, y, z = getRandombarcoTable ( ) 
        triggerClientEvent ( thePlayer, "barco_set_location", thePlayer, x, y, z ) 
    end 
      
    function onVehicleEnter ( thePlayer ) 
        if ( not Barcos [ getElementModel ( source ) ] ) then 
            return 
        end 
        if ( getElementData( thePlayer, "Occupation") == false or getElementData( thePlayer, "Occupation") ~= "Fisherman" ) then 
            return 
        end 
        if ( getElementData( thePlayer, "Occupation") == "Fisherman" ) then 
            getNewBarcoLocation ( thePlayer ) 
        end 
    end 
    addEventHandler ( "onVehicleEnter", root, onVehicleEnter ) 
      
    addEvent ( "pizza_finish", true ) 
    addEventHandler("pizza_finish", root, 
        function ( ) 
            if ( not isPedInVehicle ( source ) ) then 
                return 
            end 
            local vehicle = getPedOccupiedVehicle ( source ) 
            if ( not Barcos [ getElementModel ( vehicle ) ] ) then 
                return 
            end 
            local money = math.random ( 800, 1600 ) 
            givePlayerMoney ( source, money ) 
            setElementFrozen ( vehicle, true ) 
            fadeCamera(source, false, 1.0) 
            setTimer(fadeCamera, 1500, 1, source, true) 
            setElementFrozen ( vehicle, false ) 
            getNewBarcoLocation ( source ) 
        end 
    ) 
    

    For checking player occupation, the syntax is as follows:

    if ( getElementData( thePlayer, "Occupation") == "Fisherman" ) then -- Check if player 'Occupation' is equals to 'Fisherman' 
    

  2. Whenever you want to trigger newly created event, you need to put second attribute to 'true' else it will not work.

    In this case, it was:

    addEvent( "createSANCHEZ", true ) -- by putting true, we tell the script it is a triggering event 
    

    Total changes are:-

    In client side:

    triggerServerEvent("createSANCHEZ", getRootElement()).

    is replaced with

    triggerServerEvent("createSANCHEZ", localPlayer).

    In server side

    addEvent("createSANCHEZ") is replaced with addEvent("createSANCHEZ", true).

    thePlayer is replaced with source.

  3. Great work you did there! :)

    It is a really useful program.

    And I have a suggestion, if you didn't already implemented it yet, adding a feature to change server name would be really good.

    Hope you will finish it soon or at least make it open source to speed up the process.

    And as xXMADEXx, I too want to know the backends of it.

  4. Replace

    objects[i] = createObject (3929,yx,yy,yz) --line 49 
    

    with

    objects[i] = createObject (3929,yx,yy,yz,nil,nil,nil,false) 
    

    If the above doesn't work (probably it should), you can try using the below function.

      
    setElementCollisionsEnabled 
      
    

  5. This should do the job.

      
    mines={} 
    mines[1]={316.623046875, 2310.3662109375, 175.88377380371} 
    mines[2]={368.55038452148, 2279.5004882812, 179.28540039062} 
    mines[3]={371.35195922852, 2383.2370605469, 204.61744689941} 
    mines[4]={322.07421875, 2455.6181640625, 209.29032897949} 
    mines[5]={459.70449829102, 2427.0690917969, 191.66717529297} 
    mines[6]={534.01818847656, 2469.5270996094, 183.58447265625} 
    mines[7]={ 635.9619140625, 2403.568359375, 180.75654602051} 
    mines[8]={629.318359375, 2513.05859375, 166.53332519531} 
    mines[9]={ 757.48828125, 2565.681640625, 159.08197021484} 
    mines[10]={881.20446777344, 2574.3151855469, 160.68569946289} 
    mines[11]={778.15057373047, 2687.6740722656, 155.58869934082} 
    mines[12]={958.9248046875, 2667.8623046875, 157.94715881348} 
    mines[13]={912.7998046875, 2766.8828125, 182.83726501465} 
    mines[14]={821.197265625, 2795.1171875, 166.05780029297} 
    mines[15]={822.2978515625, 2455.7451171875, 140.25344848633} 
      
    objects = {} 
    marke = {} 
      
    function createMarkerAttachedTo(element, mType, size, r, g, b, a, visibleTo, xOffset, yOffset, zOffset) 
        mType, size, r, g, b, a, visibleTo, xOffset, yOffset, zOffset = mType or "checkpoint", size or 4, r or 0, g or 0, b or 255, a or 255, visibleTo or getRootElement(), xOffset or 0, yOffset or 0, zOffset or 0 
        assert(isElement(element), "Bad argument @ 'createMarkerAttachedTo' [Expected element at argument 1, got " .. type(element) .. "]")  
        assert(type(mType) == "string", "Bad argument @ 'createMarkerAttachedTo' [Expected string at argument 2, got " .. type(mType) .. "]")  
        assert(type(size) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 3, got " .. type(size) .. "]")  
        assert(type(r) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 4, got " .. type(r) .. "]")  
        assert(type(g) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 5, got " .. type(g) .. "]")  
        assert(type(b) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 6, got " .. type(b) .. "]")  
        assert(type(a) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 7, got " .. type(a) .. "]")  
        assert(isElement(visibleTo), "Bad argument @ 'createMarkerAttachedTo' [Expected element at argument 8, got " .. type(visibleTo) .. "]")  
        assert(type(xOffset) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 9, got " .. type(xOffset) .. "]")  
        assert(type(yOffset) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 10, got " .. type(yOffset) .. "]")  
        assert(type(zOffset) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 11, got " .. type(zOffset) .. "]") 
        local m = createMarker(0, 0, 0, mType, size, r, g, b, a, visibleTo) 
        if m then  
            if attachElements(m, element) then  
                return m  
            end  
        end  
        return false 
    end 
      
      
    addEvent ("objs",true) 
    addEventHandler ("objs",getRootElement(),function() 
        for i,v in ipairs(mines) do 
            yx,yy,yz=unpack(v) 
            objects[i] = createObject (3929,yx,yy,yz) 
            setElementData (objects[i],"mineununtrium","true") 
            setElementData(object1s[i],"qununtrium",5) 
            marke[i] = createMarkerAttachedTo (objects[variable],"corona",4,255,255,255,50,getRootElement(),0,0,10) 
        end 
    end) 
      
      
      
    addEvent ("give1",true) 
    addEventHandler ("give1",getRootElement(),function() 
    local uut = getElementData (source,"ununtrium") 
        for i=1, #mines do 
            destroyElement[objects[i]] 
            destroyElement (marke[i]) 
            objects[i] = nil 
            marke[i] = nil 
            setElementData (source,"ununtrium",uut+3) 
        end 
    end) 
      
    

  6. Any errors in dubugscript ?

    I damage one of them, the object that I've damaged has to be destroyed, instead of that, the element and marker don't get destroyed. What can I do?

    What you mean there ? You want to destroy the object, element and marker ?

  7. Try putting the event 'onClientGUIClick' inside the function 'createSpawnWindow'.

    Also add an if-statement to see, if its the correct button or not, inside the button function.

      
    function create( ) 
        if ( source == btnSancheZ ) then 
            triggerServerEvent("createSANCHEZ", getRootElement()) 
        end 
    end 
      
    

  8. Firstly, Welcome on the forums! :)

    I don't know if you still want to learn or already did but I am putting my advice on here.

    1) Start at: https://wiki.multitheftauto.com/wiki/Sc ... troduction

    If the above didn't work for you, you can try: https://forum.multitheftauto.com/viewtopic.php?f=148&t=75501

    2) Ask questions about what you didn't understand at scripting board: https://forum.multitheftauto.com/viewforum.php?f=91

    3) Try to make a simple script, such as outputting 'hello world' on screen.

    4) If it didn't work, then ask help at scripting board.

    5) Learn some more scripting by looking at tutorials: https://forum.multitheftauto.com/viewforum.php?f=148

    6) download some scripts from community and understand how they work. Community: https://community.multitheftauto.com/

    7) Practice and challenge yourself for bigger projects, such as making a whole gamemode!

    In order to learn something, you need to be curious and ask questions. As basic as it may sound, search on the forums or ask it, don't be shy!

    Hope it helps. :)

  9. It's in BLAST section lol

    And if this topic was about questioning and not giving opinions why you posted your own opinion?

    P.S Just to be clear, keep your beliefs for your own self

    (Sorry if I broke any forum rule even though it's in B.L.A.S.T)

    Hard to believe in a place that doesn't exist

    It would be really better, if you could follow your own words.

    A) I would do 2(1+1) = 1(2+2).

    Q) What would you do if you suddenly become an ant with human like physical and mental power ?

  10. Q: What would you do if you would die? Dance? Cry? or what?

    If I died I go to heaven, I guess.

    Q: What would you do if you find out that you were adopted?

    Hard to believe in a place that doesn't exist

    Looks like you are breaking a forum rule,if i am not wrong.

    Well, according to me, heaven can be anything, it can be a beautiful place with flowers,peace,happiness and other such things or it CAN be a state in which we remain unconscious, where time has been stopped forever, in which we will never feel anything neither pain nor happiness. (And btw, if i am right, this topic is about questioning and answering and not about posting opinions or judging. No offence.)

  11. If 'VIP' is a team name then this should work:-

      
    addEventHandler ( "onClientResourceStart", resourceRoot, 
        function () 
            local vehicle = getOccupiedVehicle ( localPlayer ) 
            local Shader = dxCreateShader( "shader.fx" ) 
            local Texture = dxCreateTexture( "mavericktexture.png" ) 
            if (getPlayerTeam(localPlayer) == getTeamFromName("VIP")) then 
                dxSetShaderValue( Shader, "Tex", Texture ) 
                engineApplyShaderToWorldTexture( Shader, "Bell_206B_T", vehicle ) 
            end 
        end 
    ) 
      
    

×
×
  • Create New...