Ricas Posted July 18, 2017 Share Posted July 18, 2017 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
pa3ck Posted July 18, 2017 Share Posted July 18, 2017 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. 1 Link to comment
AHMED MOSTAFA Posted July 18, 2017 Share Posted July 18, 2017 @Ricas u can use this too onVehicleStartEnter + cancelEvent Link to comment
Mohameddz Posted July 18, 2017 Share Posted July 18, 2017 I think you need this.( when player spawn hydra he can't do that becuse this vehicle is only for VIP can use it) If that what you need i can help you. Link to comment
f8upd8 Posted July 19, 2017 Share Posted July 19, 2017 (edited) 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 July 19, 2017 by f8upd8 Link to comment
Ricas Posted July 19, 2017 Author Share Posted July 19, 2017 (edited) @pa3ck Ty for helping me now its working fine but now i dont know the code to do this when players leave the hydra he Disappear Edited July 19, 2017 by Ricas Link to comment
pa3ck Posted July 19, 2017 Share Posted July 19, 2017 (edited) 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 July 19, 2017 by pa3ck Link to comment
Ricas Posted July 19, 2017 Author Share Posted July 19, 2017 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
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