Jump to content

Chronos

Members
  • Posts

    71
  • Joined

  • Last visited

Posts posted by Chronos

  1. Great resource , keep it up MrBrutus ;)

    @Wisam In case you wanna add a vehicle limits just add a check

    Here's an example

      
    function playerVehicles() 
        return dbQuery("SELECT * FROM vehicles WHERE owner=? AND ID=?", getAccountName(getPlayerAccount( client )) 
    end 
      
    

    Then add a check to the vehicleBuyRequest function

    function vehicleBuyRequest( model ) 
         -- some functions 
      
         if playerVehicles(client) >= 10 then outputChatBox(client,"You can't buy more than 10 vehicles.",255,0,0) return end 
         -- functions 
      
      
    end 
      
    

  2.   
    local elementBackpack = {} 
    function backPackBack (dataName,oldValue) 
        if getElementType(source) == "player" and dataName =="rucksak" then 
            local newValue = getElementData(source,dataName) 
            if not #newValue or #newValue <= 0 then 
                setElementData ( source, "rucksak", { 0 } ) 
                return true 
            end 
            if not oldValue or not #oldValue then 
                oldValue = { 0 } 
            end 
            if newValue[1] == 0 then 
                if elementBackpack[source] then 
                    detachElementFromBone(elementBackpack[source]) 
                    destroyElement(elementBackpack[source]) 
                    elementBackpack[source] = false 
                end 
            elseif newValue[1] ~= oldValue[1] then 
                if elementBackpack[source] then 
                    detachElementFromBone(elementBackpack[source]) 
                    destroyElement(elementBackpack[source]) 
                    elementBackpack[source] = false 
                end 
                 
                local x,y,z = getElementPosition(source) 
                local rx,ry,rz = getElementRotation(source) 
                local model = newValue[1] 
                if model == 1 then 
                    elementBackpack[source] = createObject(3026,x,y,z) 
                elseif model == 2 then 
                    elementBackpack[source] = createObject(1248,x,y,z) 
                elseif model == 3 then 
                    elementBackpack[source] = createObject(1575,x,y,z) 
                elseif model == 4 then 
                    elementBackpack[source] = createObject(1252,x,y,z) 
                elseif model == 5 then 
                    elementBackpack[source] = createObject(2405,x,y,z) 
                else 
                return false 
                end 
                if model == 3 then 
                    attachElementToBone(elementBackpack[source],source,3,0,-0.16,0.05,270,0,180) 
                else 
                    attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0) 
                end 
            end 
        end 
        if getElementType(source) == "player" and dataName == "helmetOn" then 
            if getElementData ( source, dataName ) then 
                local x, y, z = getElementPosition(source) 
                local helmet = createObject(2052, x, y, z) 
                setElementData ( source, "helmetObject", helmet ) 
                local skin = getElementModel ( source ) 
                if skin == 73 then 
                    attachElementToBone(helmet, source, 1, 0, 0.02, -0.53, 0, 0, 90) 
                elseif skin == 287 then 
                    attachElementToBone(helmet, source, 1, 0, 0.01, -0.56, 0, 0, 90) 
                elseif skin == 18 then 
                    attachElementToBone(helmet, source, 1, 0.015, 0.025, -0.54, 0, 0, 90) 
                elseif skin == 23 then 
                    attachElementToBone(helmet, source, 1, 0, 0.015, -0.574, 0, 0, 90) 
                elseif skin == 24 then 
                    attachElementToBone(helmet, source, 1, 0, 0.015, -0.575, 0, 0, 90) 
                elseif skin == 1 then 
                    attachElementToBone(helmet, source, 1, 0, 0.015, -0.545, 0, 0, 90) 
                elseif skin == 2 then 
                    attachElementToBone(helmet, source, 1, 0.015, 0.025, -0.59, 0, 0, 90) 
                else 
                    attachElementToBone(helmet, source, 1, 0, 0.015, -115, 0, 0, 90) 
                end 
            else 
                if isElement ( getElementData ( source, "helmetObject" ) ) then 
                    detachElementFromBone( getElementData ( source, "helmetObject" ) ) 
                    destroyElement ( getElementData ( source, "helmetObject" ) ) 
                    setElementData ( source, "helmetObject", false ) 
                end 
            end 
        end 
    end 
    addEventHandler ( "onElementDataChange", getRootElement(), backPackBack ) 
    

  3. Check this example from wiki,It might be usefull for you

    theTimer = setTimer(function() end, 1000, 10) -- A timer that does nothing. 
      
    function timerDetails() 
        remaining, executesRemaining, totalExecutes = getTimerDetails(theTimer) -- Get the timers details 
        if (remaining and executesRemaining and totalExecutes) then 
            outputChatBox("Time remaining this second: "..remaining.." Executes remaining: "..executesRemaining.." Total executes: "..totalExecutes) 
        else 
            outputChatBox("Timer no longer exists") 
        end 
    end 
    addCommandHandler("timerdetails", timerDetails) 
    

  4. Did you even read the topic?

    You'll have to script the actual job functions yourself and you can use: getElementData(player, "Role") to get the players job.

    Check the script above I've already use

        local job = getElementData(player, "Police Officer") 
        if job then 
    

    ....

  5. This script's outdate could recompile it ! also to get data i use this but doesn't work

    function createPoliceTeam () 
        Policeteam = createTeam ("Police ", 0, 0, 200) 
    end 
    addEventHandler ("onResourceStart", resourceRoot, createPoliceTeam) 
    -- Join the police forces 
    function joinPolice() 
        local job = getElementData(player, "Police Officer")  
        if job then 
    ... 
    

  6. Greeting everybody,

    I am working on something which is a rhino that can fly with some attached weapons such as MG and missiles,The problem is I search all over wiki /Forum for a function that I can use to set missiles locked in target (Like the hydra one's)

  7. i think i got your point,download Navicate Premium,after installation open it, create SQLite connection and chose internal.db,

    then open it,you will find some tables,check accounts one.

    still need help post here or send me a pm.

  8. please any scripters fix my script

    this is server script

    ArmedForcesteam = createTeam ("Armed Forces",0, 160, 0) 
    createBlip ( 95.459037780762, 1923.5686035156, 18.107088088989, 56 ) 
      
    function joinArmedForces() 
         setPlayerTeam(source,ArmedForcesteam) 
      
        local x,y = guiGetScreenSize()    
         setElementModel(source, 287) 
          giveWeapon ( source, 3 ) 
             setElementData( source, "Occupation", "ArmedForcesteam", true ) 
         exports.DENhelp:createNewHelpMessage("You are now a soldier.",source,69,139,0) 
    end 
    addEvent("setArmedForces", true) 
    addEventHandler("setArmedForces",root,joinArmedForces) 
      
    function policeJob ( attacker, attackerweapon, bodypart, loss ) 
            theTeam = getPlayerTeam ( attacker )  
            if (attackerweapon == 3) and (loss > 2 ) then 
                    setElementPosition (source, 219, 110, 999, true) 
                    setTimer ( setElementPosition, 100000, 1, source, 236.32, 110.4, 1003.2) 
                    takePlayerMoney (source, 50) 
                    givePlayerMoney (attacker, 100) 
      end 
    end 
    

    this is Client script

            local marker = createMarker(  95.459037780762, 1923, 18.107088088989, "Cylinder", 1.5, 0, 69, 139, 0)   
        
            GUIEditor_Button = {} 
            GUIEditor_Memo = {} 
            GUIEditor_Label = {} 
              
            function guiMyCwindow(w,h,t) 
             
             
      
             
            end 
              
            windowjob = guiCreateWindow(1031,232,301,397,"Armed job",true) 
            guiSetVisible(windowjob, false) 
            GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob) 
            GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
            GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob) 
            GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"To take Armed job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) 
             guiEditSetReadOnly(GUIEditor_Memo[1],true) 
              
            function Armed_Forces(hitElement) 
                 if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                      if not guiGetVisible(windowjob) then 
                           guiSetVisible(windowjob, true) 
                           showCursor(true) 
                      end 
                 end 
            end 
            addEventHandler("onClientMarkerHit", marker, Armed_Forces) 
             
            function joinTeam() 
                 triggerServerEvent("set Armed Forces",localPlayer) 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientMarkerHit", marker, Armed_Forces) 
              
            function Soliderjobleave(leaveElement) 
                 if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                      if guiGetVisible(windowjob) then 
                           guiSetVisible(windowjob, false) 
                           showCursor(false) 
                      end 
                 end 
            end 
            addEventHandler("onClientMarkerLeave", marker, Soliderjobleave) 
              
            function joinTeam() 
                 triggerServerEvent("set Armed Forces",localPlayer) 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
              
            function removeArmedForcesWindow() 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeArmedForcesWindow, false) 
    

    also

    i can't spawn any cars
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Grid = {} 
              
        car = { 
                {520}, 
                {425}, 
                {519}, 
                {447}, 
                {476}, 
                {511}, 
                {522}, 
                {468}, 
                {432}, 
                {428}, 
                {470}, 
                {579}, 
                {541} 
        }   
        local teamName = "Armed Forces" 
        local marker = createMarker( 307.29235839839844, 1804.0922851563, 17.640625, "cylinder", 1.5, 255 ,255, 255, 155)       
        local marker2 = createMarker( 205.28984069824, 1917.2662353516, 16.640625, "cylinder", 1.5, 255 ,255, 255, 155) 
          
          
        GUIEditor_Window[1] = guiCreateWindow(312 ,152 ,165 ,339 ,"vehicle",false) 
        guiSetVisible(GUIEditor_Window[1],false) 
        GUIEditor_Grid[1] = guiCreateGridList(9,19,147,274,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
        guiGridListAddColumn(GUIEditor_Grid[1],"vehicle name",60) 
        GUIEditor_Button[1] = guiCreateButton(9,296,69,34,"ok",false,GUIEditor_Window[1]) 
        GUIEditor_Button[2] = guiCreateButton(86,296,70,34,"close",false,GUIEditor_Window[1]) 
          
        for i,v in ipairs (car) do 
                local carName = getVehicleNameFromModel (v[1]) 
                local row = guiGridListAddRow (GUIEditor_Grid[1]) 
                    guiGridListSetItemText (GUIEditor_Grid[1], row, 1, carName, false, true) 
        end 
          
        function onClientClick (button, state, absoluteX, absoluteYe) 
                if (source == GUIEditor_Button[1]) then 
                        if (guiGridListGetSelectedItem (GUIEditor_Grid[1])) then 
                          local cars = guiGridListGetItemText (GUIEditor_Grid[1], guiGridListGetSelectedItem (GUIEditor_Grid[1]), 1) 
                          triggerServerEvent ("cars", getLocalPlayer(), cars) 
                        end 
                end 
        end 
        addEventHandler ("onClientGUIClick", GUIEditor_Button[1], onClientClick) 
          
        function onClientClick (button, state, absoluteX, absoluteYe) 
                if (source == GUIEditor_Button[2]) then 
                        guiSetVisible(GUIEditor_Window[1],false) 
                        showCursor(false) 
                end 
        end 
        addEventHandler ("onClientGUIClick", GUIEditor_Button[2], onClientClick) 
          
        addEventHandler("onClientMarkerHit", marker, 
                function ( hitPlayer, matchingDimension ) 
                        if ( isElementWithinMarker(hitPlayer, marker) ) then 
                                if ( getTeamName( getPlayerTeam( hitPlayer ) ) == teamName ) then 
                                        if getElementType(hitPlayer) == "player" then 
                                                guiSetVisible ( GUIEditor_Window[1], true ) 
                                                showCursor(true) 
                                        end 
                                else 
                                exports.DENhelp:createNewHelpMessage( "You Are Not In The Team", 0, 255, 0 ) 
                                end 
                        end 
                end 
        ) 
          
        addEventHandler("onClientMarkerHit", marker2, 
                function ( hitPlayer, matchingDimension ) 
                        if ( isElementWithinMarker(hitPlayer, marker2) ) then 
                                if ( getTeamName( getPlayerTeam( hitPlayer ) ) == teamName ) then 
                                        if getElementType(hitPlayer) == "player" then 
                                                guiSetVisible ( GUIEditor_Window[1], true ) 
                                                showCursor(true) 
                                        end 
                                else 
                                exports.DENhelp:createNewHelpMessage( "You Are Not In The Team", 0, 255, 0 ) 
                                end 
                        end 
                end 
        ) 
          
          
    

    addEvent ("cars", true) 
    addEventHandler ("cars", getRootElement(), 
        function(cars) 
                    if isElement( veh ) then destroyElement( veh ) end 
                            local cn = getVehicleModelFromName (cars) 
                            local x,y,z = getElementPosition(source) 
                            local cn2 = getVehicleNameFromModel (cn) 
                            veh = createVehicle(cn, x,y,z) 
                            setVehicleColor(veh, 23, 75, 4) 
                            warpPedIntoVehicle(source, veh) 
                            outputChatBox ( "* "..cn2.."  was created!" )             
        end 
    ) 
    

    you just copy my script and post it here,if you copy something then please do it professionally.

    http://cit2.net/index.php?topic=80583.0

×
×
  • Create New...