Jump to content

How I put Hydra only for VIP


Ricas

Recommended Posts

    function hydra () 
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
     local x, y, z = getElementPosition ( client ) 
     hydra = createVehicle ( 520, x, y, z  ) 
     warpPedIntoVehicle (client, hydra )  	 
    end 
    end 
	
addCommandHandler ( "Hydra", hydra )   

this code is creating errors pls help

Link to comment
function hydra (thePlayer) 
  local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
  if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
    local x, y, z = getElementPosition ( thePlayer ) 
    local hydra = createVehicle ( 520, x, y, z  ) 
    warpPedIntoVehicle (thePlayer, hydra )  	 
  end 
end 
	
addCommandHandler ( "Hydra", hydra )   

Try this, next time please type "/debugscript 3" and take a screenshot / write down the error(s) that may come up as well, that way we can easily identify the problem.

The problem here was that the thePlayer was not defined and you used "client", which is not available at the addCommandHandler event handler. 

  • Like 1
Link to comment
13 hours ago, Ricas said:

    function hydra () 
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
     local x, y, z = getElementPosition ( client ) 
     hydra = createVehicle ( 520, x, y, z  ) 
     warpPedIntoVehicle (client, hydra )  	 
    end 
    end 
	
addCommandHandler ( "Hydra", hydra )   

this code is creating errors pls help

If you want to survive here, please attach your debug text here when asking for help. And please, when nesting cod into any new area, use TAB's spaces.

Edited by f8upd8
Link to comment
function destroyVIPHydra (veh) 
  local accName = getAccountName ( getPlayerAccount ( source ) )
  if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) and getElementModel(veh) == 520 then 
    destroyElement(veh)
    outputChatBox("Your VIP Hydra has been destroyed..", source)
  end 
end 
addEventHandler("onPlayerVehicleExit", root, destroyVIPHydra)

Try this, it should destroy the hydra when VIP players leave them.

Edited by pa3ck
Link to comment
35 minutes ago, pa3ck said:

function destroyVIPHydra (veh) 
  local accName = getAccountName ( getPlayerAccount ( source ) )
  if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) and getElementModel(veh) == 520 then 
    destroyElement(veh)
    outputChatBox("Your VIP Hydra has been destroyed..", source)
  end 
end 
addEventHandler("onPlayerVehicleExit", root, destroyVIPHydra)

Try this, it should destroy the hydra when VIP players leave them.

Ty u for help me

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...