Jump to content

ville

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by ville

  1. Hi, i want to modify this script so polices can give tickets to criminals, i added that wanted line .. but its not working. I want to know what im doing wrong

    function mandat(player, cmd, who, ile) 
    local who = getPlayerFromName(who) 
    if getPlayerTeam(player) == getTeamFromName("Police") then 
    takePlayerMoney(who, tonumber(ile)) 
    outputChatBox("Player "..getPlayerName(who).." has been given ticket ("..tonumber(ile).."$)") 
    end 
    end 
    addCommandHandler("ticket", mandat) 
    

  2. players = getElementsByType("player") 
      
    addEventHandler("onResourceStart", resourceRoot, 
    function() 
       for index,player in ipairs(players) do 
       bindKey(player, "M","down", sirens) 
       end 
    end) 
      
    function sirens(player) 
    local veh = getPedOccupiedVehicle(player) 
        if (veh) then 
          addVehicleSirens(veh,1,1) 
            if not getVehicleSirensOn (veh) then 
                setVehicleSirensOn (veh, true) 
            else 
                setVehicleSirensOn (veh, false) 
                removeVehicleSirens(veh) 
            end 
        end 
    end 
    

    I dont know.. I have 2 siren files need to replace like first when u turn firens on and the other siren when u pressing siren button

  3. i have little wantedoff thing, you can get your start rid with it. Now is there any way to disable jetpack and F1 while hawing wanted level?

    addCommandHandler("wantedoff", function(pSource) 
             if getPlayerMoney(pSource) < 5000 then 
              outputChatBox("* Police: You don't have enough money!", pSource, 255, 0, 0) 
         return end 
         outputChatBox("* Police: You are clear now.", pSource, 0,255,0) 
        takePlayerMoney(pSource, 1000) 
       setPlayerWantedLevel(pSource, 0) 
    end ) 
      
    

  4. Create a table like plane = {} and create the vehicle like : plane[hitElement] = createVehicle....

    and destroy it like : destroyElement(plane[thePlayer])

    Aand the best thing is .. i dont really understand tables yet :P

  5. missionMarker = createMarker ( -1626.1, -373.5, 13.4, "cylinder", 2, 0, 255, 255, 170 ) 
    addEventHandler("onResourceStart", resourceRoot, 
    function ( ) 
     missionBlip = createBlipAttachedTo(missionMarker,53) 
        outputChatBox( "[Plane Mission] Ota ammatti lähtölippu kuvakkelta.", player, 0, 255, 255 ) 
     end 
    ) 
      
    addEventHandler("onMarkerHit", missionMarker, 
    function ( hitElement ) 
        if (getElementType ( hitElement ) == 'player'  ) then 
        plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) 
        warpPedIntoVehicle ( hitElement, plane ) 
        outputChatBox( "[Plane Mission] Lennä punaiselle lipulle.", hitElement, 0, 255, 255 ) 
        finalMarker = createMarker (338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) 
        finalBlip = createBlipAttachedTo(finalMarker,19) 
     end 
    end 
    ) 
      
      
      
    function Remove(thePlayer) 
        if (getElementType(thePlayer) == "player") then 
            if (finalMarker ~= nil) and (source == finalMarker) then 
                if isElement(finalMarker) then 
                    givePlayerMoney ( thePlayer, 10000 ) 
                    removeEventHandler("onMarkerHit", finalMarker, Remove) 
                    destroyElement(finalMarker) 
                    outputChatBox( "[Plane Mission] Kiitos kun veit lentokoneen huoltoon. Saat 10K palkkiota.", hitElement, 0, 255, 255 ) 
                end 
                if isElement(finalBlip) and isElement(plane) then 
                    destroyElement(finalBlip) 
                    destroyElement(plane) 
                end 
            end 
        end 
    end 
    addEventHandler("onMarkerHit", getRootElement(), Remove) 
    

    Thanks, but now i have problem.. if 2 players are doing plane mission sametime and one goes to finalmarker and gets his reward, then the other one goes and nothing happens :D

  6. i have done plane mission working correctly, but how can i do that the plane gets destroyed after finished mission? i have tried so many things

    missionMarker = createMarker ( -1626.1, -373.5, 13.4, "cylinder", 2, 0, 255, 255, 170 ) 
    addEventHandler("onResourceStart", resourceRoot, 
    function ( ) 
     missionBlip = createBlipAttachedTo(missionMarker,53) 
        outputChatBox( "[Plane Mission] Ota ammatti lähtölippu kuvakkelta.", player, 0, 255, 255 ) 
     end 
    ) 
      
    addEventHandler("onMarkerHit", missionMarker, 
    function ( hitElement ) 
        if (getElementType ( hitElement ) == 'player'  ) then 
        local plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) 
        warpPedIntoVehicle ( hitElement, plane ) 
        outputChatBox( "[Plane Mission] Lennä punaiselle lipulle.", hitElement, 0, 255, 255 ) 
        finalMarker = createMarker ( 338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) 
        finalBlip = createBlipAttachedTo(finalMarker,19) 
     end 
    end 
    ) 
      
      
      
    function Remove(thePlayer) 
        if (getElementType(thePlayer) == "player") then 
            if (finalMarker ~= nil) and (source == finalMarker) then 
                if isElement(finalMarker) then 
                    givePlayerMoney ( thePlayer, 10000 ) 
                    removeEventHandler("onMarkerHit", finalMarker, Remove) 
                    destroyElement(finalMarker) 
                    outputChatBox( "[Plane Mission] Kiitos kun veit lentokoneen huoltoon. Saat 10K palkkiota.", hitElement, 0, 255, 255 ) 
                end 
                if isElement(finalBlip) then 
                    destroyElement(finalBlip) 
                end 
            end 
        end 
    end 
    addEventHandler("onMarkerHit", getRootElement(), Remove) 
    

  7. Hi, i have greenzone setted up right, but people can be killed from explosion and from long distance shooting.. Do i miss something.. Dont laugh at me i'm noob who tries to learn scripting

    x, y, size = -1997, 239, 120 
    local greenzone = createColRectangle ( -1997, 239, 110, 80 ) 
    local greenzonemaparea = createRadarArea (-1997, 239, 110, 80, 0, 255, 0, 120) 
      
    function greenzoneEnter ( thePlayer, matchingDimension ) 
    if getElementType( thePlayer ) ~= "player" then return end 
    toggleControl ( thePlayer, "fire", false ) 
    toggleControl ( thePlayer, "next_weapon", false ) 
    toggleControl ( thePlayer, "previous_weapon", false ) 
    setPedWeaponSlot ( thePlayer, 0 ) 
    toggleControl ( thePlayer, "aim_weapon", false ) 
    toggleControl ( thePlayer, "vehicle_fire", false ) 
    toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
    end 
    addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) 
      
    function greenzoneExit ( thePlayer, matchingDimension ) 
    if getElementType( thePlayer ) ~= "player" then return end 
    toggleControl ( thePlayer, "fire", true ) 
    toggleControl ( thePlayer, "next_weapon", true ) 
    toggleControl ( thePlayer, "previous_weapon", true ) 
    toggleControl ( thePlayer, "aim_weapon", true ) 
    toggleControl ( thePlayer, "vehicle_fire", true ) 
    toggleControl ( thePlayer, "vehicle_secondary_fire", true ) 
    end 
      
    addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit ) 
    

  8. Hello, i started making liquor and limonade storage robbery. Limonade storage works fine but then i cant rob liquor store? Can someone help me, im new in scripting..

    function createRob() 
        Marker = createMarker ( 1324.40,286.06,20, "cylinder", 1, 173, 255, 47, 170 ) 
        setElementCollisionsEnabled( Marker, false ) 
        bl = createBlipAttachedTo(Marker,56) 
        outputChatBox( "Limonade storage robbary available!. Rob it from yellow dot blip.", root, 0, 255, 0 ) 
    end 
    addEventHandler("onResourceStart", resourceRoot,createRob) 
      
    function createRob2() 
        Marker = createMarker ( 1359.57,205.12,19, "cylinder", 1, 173, 255, 47, 170 ) 
        setElementCollisionsEnabled( Marker, false ) 
        bl = createBlipAttachedTo(Marker,49) 
        outputChatBox( "Liquor store available!. Rob it from drink blip.", root, 0, 255, 0 ) 
    end 
    addEventHandler("onResourceStart", resourceRoot,createRob2) 
      
    addEventHandler("onMarkerLeave",root, 
    function ( player ) 
        if ( source ~= Marker ) then 
            return 
        end 
        if ( isPedInVehicle( player ) ) then 
            return 
        end 
        local playerTeam = getPlayerTeam(player) 
        if ( getTeamName(playerTeam) == "Criminal" ) then 
         
            destroyElement( Marker ) 
            destroyElement( bl ) 
            randomMoney = math.random ( 5000, 15000 ) 
            randomWanted = math.random ( 5, 6 ) 
            givePlayerMoney(player,randomMoney) 
            setPlayerWantedLevel ( player, randomWanted ) 
            robPlayer = getPlayerName(player) 
            outputChatBox("#ffffff[#00ff00ALARM!#ffffff] #c48027" .. robPlayer .. " #ff0000robbed liquor store/limonade store, and earned #00ff00" .. tostring(randomMoney) .."$ #ff0000and #00ff00" .. tostring(randomWanted) .. "#ff0000 starts.",root,0,255,0,true) 
            setTimer( createRob, 600000, 1 ) 
        else 
            outputChatBox("#ffffff[#00ff00PROTIP#ffffff] #ff0000You need to be criminal!",player,0,255,0,true) 
        end 
    end 
    ) 
    

  9. Wath about this ?
    function takeWantedLvl(player) 
        if getAccountName(getPlayerAccount(player)) == "Ville" then 
            local money = getPlayerMoney(player) 
            if (money >= 1000) then 
                outputChatBox("* Police: You are clear now.", player, 0,255,0) 
                takePlayerMoney(player, 1000) 
                setPlayerWantedLevel(player, 0) 
            elseif (money < 1000) then 
                outputChatBox("* Police: You don't have enough money!", player, 255, 0, 0) 
            end 
        end 
    end 
    addCommandHandler("wantedoff", takeWantedLvl) 
    

    Now its working! Thanks :P

  10. try now:
    addCommandHandler("wantedoff", 
    function() 
        if getAccountName(getPlayerAccount(source)) == "Ville" then 
            local money = getPlayerMoney(source) 
            if (money >= 1000) then 
                outputChatBox("* Police: You are clear now.", source, 0,255,0) 
                takePlayerMoney(source, 1000) 
                setPlayerWantedLevel(source, 0) 
            elseif (money < 1000) then 
                outputChatBox("* Police: You don't have enough money!", source, 255, 0, 0) 
            return 
            end 
        end 
    end ) 
    

    Now it doesnt work at all.. I get on debugscript: attempt to compare nil with number

  11. Hi guys im new scripting but no im trying to make /wantedoff. It does change your wanted level to 0, it costs 1k. but i want to make it 1k for only player called Ville. i tested it and it worked for every player.. so can anyone help me :oops:

    addCommandHandler("wantedoff", function(pSource) 
             if getAccountName(getPlayerAccount(player)) == "Ville" then 
         elseif getPlayerMoney(pSource) < 1000 then 
              outputChatBox("* Police: You don't have enough money!", pSource, 255, 0, 0) 
         return end 
         outputChatBox("* Police: You are clear now.", pSource, 0,255,0) 
        takePlayerMoney(pSource, 1000) 
       setPlayerWantedLevel(pSource, 0) 
    end ) 
      
    

×
×
  • Create New...