Flipi Posted August 25, 2013 Posted August 25, 2013 (edited) not work , i need a solution please (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 August 25, 2013 by Guest
Flipi Posted August 25, 2013 Author Posted August 25, 2013 What is that supposed to do? that only admins shoot rocket in car
Flipi Posted August 25, 2013 Author Posted August 25, 2013 use triggerClientEvent I can not do (I confused u.u)
EstrategiaGTA Posted August 25, 2013 Posted August 25, 2013 Just do the same that you did but the opposite.
Flipi Posted August 25, 2013 Author Posted August 25, 2013 Just do the same that you did but the opposite. aah oks
WASSIm. Posted August 25, 2013 Posted August 25, 2013 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)
Flipi Posted August 25, 2013 Author Posted August 25, 2013 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?!
Castillo Posted August 25, 2013 Posted August 25, 2013 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)
Flipi Posted August 25, 2013 Author Posted August 25, 2013 Thanks Solidsnake14, WASSIm., are the best !
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now