The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 865 - File: inc/plugins/thankyoulike.php PHP 7.3.3 (Linux)
File Line Function
/inc/plugins/thankyoulike.php 865 errorHandler->error
/inc/class_plugins.php 139 thankyoulike_postbit
/inc/functions_post.php 826 pluginSystem->run_hooks
/showthread.php 1070 build_postbit
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 870 - File: inc/plugins/thankyoulike.php PHP 7.3.3 (Linux)
File Line Function
/inc/plugins/thankyoulike.php 870 errorHandler->error
/inc/class_plugins.php 139 thankyoulike_postbit
/inc/functions_post.php 826 pluginSystem->run_hooks
/showthread.php 1070 build_postbit
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 865 - File: inc/plugins/thankyoulike.php PHP 7.3.3 (Linux)
File Line Function
/inc/plugins/thankyoulike.php 865 errorHandler->error
/inc/class_plugins.php 139 thankyoulike_postbit
/inc/functions_post.php 826 pluginSystem->run_hooks
/showthread.php 1070 build_postbit
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 870 - File: inc/plugins/thankyoulike.php PHP 7.3.3 (Linux)
File Line Function
/inc/plugins/thankyoulike.php 870 errorHandler->error
/inc/class_plugins.php 139 thankyoulike_postbit
/inc/functions_post.php 826 pluginSystem->run_hooks
/showthread.php 1070 build_postbit
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 865 - File: inc/plugins/thankyoulike.php PHP 7.3.3 (Linux)
File Line Function
/inc/plugins/thankyoulike.php 865 errorHandler->error
/inc/class_plugins.php 139 thankyoulike_postbit
/inc/functions_post.php 826 pluginSystem->run_hooks
/showthread.php 1070 build_postbit
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 870 - File: inc/plugins/thankyoulike.php PHP 7.3.3 (Linux)
File Line Function
/inc/plugins/thankyoulike.php 870 errorHandler->error
/inc/class_plugins.php 139 thankyoulike_postbit
/inc/functions_post.php 826 pluginSystem->run_hooks
/showthread.php 1070 build_postbit




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shooter script
#1
Hello, today I want to show a simple script.
This script is designed for a rocket vehicle, which means you can shoot  a rocket from your vehicle.


Code:
cLP = getLocalPlayer()
screenWidth, screenHeight = guiGetScreenSize()

function cRStest()
    setTimer(resourcesCheck, 10000, 1)
end
addEventHandler("onClientResourceStart", getRootElement(), cRStest)

function resourcesCheck()
    if check=="done" then return
    else
        setRadioChannel(0)
        setTimer(cbinds, 1000, 1)
        textToggle=0
        check="done"
    end
end

function cRS()
    if check=="done" then return
    else
        setRadioChannel(0)
        setTimer(cbinds, 3333, 1)
        textToggle=0
        check="done"
    end
end
addEventHandler("onClientPlayerSpawn", getLocalPlayer(), cRS)

function markers(player)
    if isPedInVehicle(player) then
        local vehicle = getPedOccupiedVehicle(player)
        fixVehicle(vehicle)
    end
end
addEventHandler("onClientMarkerHit", getResourceRootElement(getThisResource()), markers)

function cbinds()
    local keys1 = getBoundKeys("vehicle_fire")
    local keys2 = getBoundKeys("vehicle_secondary_fire")
    if keys1 then
        for keyName, state in pairs(keys1) do
            bindKey(keyName, "down", cdoshoot)
        end
        bindKey("F", "down", cdoshoot)
        cbindsText = "- Press F or the button you use to fire to shoot rockets!\n- You can shoot once every 3 seconds."
    end
    if keys2 then
        for keyName, state in pairs(keys2) do
            bindKey(keyName, "down", cdoshoot)
        end
    end
    if (not keys1) and (not keys2) then
        bindKey("F", "down", cdoshoot)
        bindKey("lctrl", "down", cdoshoot)
        bindKey("rctrl", "down", cdoshoot)
        cbindsText = "- Press F or CTRL to shoot rockets!\n- You can shoot once every 3 seconds."
    end
    theVehicle = getPedOccupiedVehicle(cLP)
    allowShoots()
    bindKey("M", "down", toggleText)
    outputChatBox("#FF0000Press #00ff00M #ff0000to show/hide instructions! :D", 255, 255, 255, true)
end

function toggleText()
    if textToggle==0 then
        addEventHandler("onClientRender", getRootElement(), bindsText)
        textToggle=1
    elseif textToggle==1 then
        removeEventHandler("onClientRender", getRootElement(), bindsText)
        textToggle=0
    end
end

function allowShoots()
    bindTrigger = 1
end

function cdoshoot()
    if bindTrigger == 1 then
        if not isPlayerDead(cLP) then
            bindTrigger = 0
            local x,y,z = getElementPosition(theVehicle)
            local rX,rY,rZ = getVehicleRotation(theVehicle)
            local x = x+4*math.cos(math.rad(rZ+90))
            local y = y+4*math.sin(math.rad(rZ+90))
            createProjectile(theVehicle, 19, x, y, z, 1.0, nil)
            setTimer(allowShoots, 3000, 1)
        end
    end
end

function bindsText()
    dxDrawText(cbindsText, screenWidth/15, screenHeight/2.5, screenWidth, screenHeight, tocolor(0, 149, 254, 255), 0.75, "bankgothic")
end
Made by Edos.
Každý by mal mať svoj sen, za ktorým si ide, pretože vzdať to a nedôjsť do cieľa, keď sme už na trati, je to najväčšie zlyhanie.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)