Jump to content

Help!


Flipi

Recommended Posts

not work :/, i need a solution please :S (shoot rocket car admin)

--Client--

local shootTimer = nil 
function shoot(localPlayer) 
  
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    if not isElement(vehicle) then return end 
    if(not isTimer(shootTimer))then 
    triggerServerEvent("shoting", localPlayer) 
        local posX, posY, posZ = getElementPosition(vehicle) 
        shootTimer = setTimer(function()end, 3333, 1) 
        createProjectile(vehicle, 19, posX, posY, posZ, 1.0) 
    end 
end 
bindKey("vehicle_fire", "down", shoot) 
bindKey("vehicle_secondary_fire", "down", shoot) 

--Server

addEvent("shoting", true) 
function chot(player) 
 local accountName = getAccountName ( getPlayerAccount ( player ) ) 
    if ( not isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
    end 
end 
addEventHandler("shoting", root, chot) 

Edited by Guest
Link to comment

CLIENT

function Projectile(owner,id,x,y,z,force) 
    createProjectile(owner,id,x,y,z,force) 
end 
addEvent("createProjectileServer", true) 
addEventHandler("createProjectileServer", root, Projectile) 

SERVER

local shootTimer = nil 
function shoot( ) 
    local accountName = getAccountName ( getPlayerAccount ( source ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
        local vehicle = getPedOccupiedVehicle(source) 
        if vehicle then 
            if not (isTimer(shootTimer)) then 
                local posX, posY, posZ = getElementPosition(vehicle) 
                shootTimer = setTimer(function()end, 3333, 1) 
                triggerClientEvent ( "createProjectileServer", getRootElement(), vehicle, 19, posX, posY, posZ, 1.0) 
            end 
        end 
    end 
end 
  
function bindOnJoin() 
    bindKey(source, "vehicle_fire", "down", shoot) 
    bindKey(source, "vehicle_secondary_fire", "down", shoot) 
end 
addEventHandler("onPlayerJoin", root, bindOnJoin) 
  
function bindOnStart() 
    for index, thePlayer in pairs(getElementsByType("player")) do 
        bindKey(thePlayer, "vehicle_fire", "down", shoot) 
        bindKey(thePlayer, "vehicle_secondary_fire", "down", shoot) 
    end 
end 
addEventHandler("onResourceStart", getResourceRootElement(), bindOnStart) 

Link to comment

error: [Warning: : 3 : Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]

-----[Warning: : 3 : Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]

-----[Error: : 4 : attempt to concatenate local 'account Name' (a boolean value)

what happens?!

Link to comment
local shootTimer = nil 
function shoot( thePlayer ) 
    local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
        local vehicle = getPedOccupiedVehicle(thePlayer) 
        if vehicle then 
            if not (isTimer(shootTimer)) then 
                local posX, posY, posZ = getElementPosition(vehicle) 
                shootTimer = setTimer(function()end, 3333, 1) 
                triggerClientEvent ( "createProjectileServer", getRootElement(), vehicle, 19, posX, posY, posZ, 1.0) 
            end 
        end 
    end 
end 
  
function bindOnJoin() 
    bindKey(source, "vehicle_fire", "down", shoot) 
    bindKey(source, "vehicle_secondary_fire", "down", shoot) 
end 
addEventHandler("onPlayerJoin", root, bindOnJoin) 
  
function bindOnStart() 
    for index, thePlayer in pairs(getElementsByType("player")) do 
        bindKey(thePlayer, "vehicle_fire", "down", shoot) 
        bindKey(thePlayer, "vehicle_secondary_fire", "down", shoot) 
    end 
end 
addEventHandler("onResourceStart", getResourceRootElement(), bindOnStart) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...