devildead622 Posted March 16, 2013 Share Posted March 16, 2013 to make of this? addEventHandler('onVehicleExit',veh,function() setTimer ( function() destroyElement( veh ) setElementData(player, "bike", false) end, 100, 1 ) end) Link to comment
TAPL Posted March 16, 2013 Share Posted March 16, 2013 Where do veh defined? Where do player defined? Link to comment
devildead622 Posted March 16, 2013 Author Share Posted March 16, 2013 to make of this? function givebike( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then if not bike then local x,y,z= getElementPosition(player) veh = createVehicle(509, x+1, y, z) warpPedIntoVehicle(player, veh) setElementData(player, "bike", true) addEventHandler('onVehicleExit',veh,function() setTimer ( function() destroyElement( veh ) setElementData(player, "bike", false) end, 100, 1 ) end) else outputChatBox ( "Voce nao pode pegar duas Bikes ao mesmo tempo?", player, 255,0,0, true) end end end addCommandHandler("bikevip",givebike) the only thing I have doubts and this addEventHandler('onVehicleExit',veh,function() setTimer ( function() destroyElement( veh ) setElementData(player, "bike", false) end, 100, 1 ) end) Link to comment
TAPL Posted March 16, 2013 Share Posted March 16, 2013 addEventHandler("onVehicleExit", veh, function(player) setTimer(function(source, player) destroyElement(source) setElementData(player, "bike", false) end, 100, 1, source, player) end) Link to comment
devildead622 Posted March 16, 2013 Author Share Posted March 16, 2013 thanks! this? function givebike( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then if not bike then local x,y,z= getElementPosition(player) veh = createVehicle(509, x+1, y, z) warpPedIntoVehicle(player, veh) setElementData(player, "bike", true) addEventHandler("onVehicleExit", veh, function(player) setTimer(function(source, player) destroyElement(source) setElementData(player, "bike", false) end, 100, 1, source, player) end) else outputChatBox ( "Voce nao pode pegar duas Bikes ao mesmo tempo!", player, 255,0,0, true) end end end addCommandHandler("bikevip",givebike) Link to comment
devildead622 Posted March 16, 2013 Author Share Posted March 16, 2013 how so? destroyElement(source) should not be this? destroyElement(veh) Link to comment
iPrestege Posted March 16, 2013 Share Posted March 16, 2013 You want to destroy the vehicle? Link to comment
devildead622 Posted March 16, 2013 Author Share Posted March 16, 2013 function(player) setTimer(function(veh, player) destroyElement(veh) setElementData(player, "bike", false) end, 100, 1, veh, player) end) this? Link to comment
iPrestege Posted March 16, 2013 Share Posted March 16, 2013 function givebike( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then if not bike then local x,y,z= getElementPosition(player) veh = createVehicle(509, x+1, y, z) warpPedIntoVehicle(player, veh) setElementData(player, "bike", true) addEventHandler("onVehicleExit", veh, function(player) setTimer(function(veh,player) destroyElement(veh) setElementData(player, "bike", false) end, 100, 1, source, player) end) else outputChatBox ( "Voce nao pode pegar duas Bikes ao mesmo tempo!", player, 255,0,0, true) end end end addCommandHandler("bikevip",givebike) try it . =========== but what you mean in the code by not "bike" ? you mean the data? Link to comment
TAPL Posted March 16, 2013 Share Posted March 16, 2013 function givebike( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..accName, aclGetGroup("Vip")) then if not getElementData(player, "bike") then local x, y, z= getElementPosition(player) local veh = createVehicle(509, x+1, y, z) warpPedIntoVehicle(player, veh) setElementData(player, "bike", true) addEventHandler("onVehicleExit", veh, function(player) setTimer(function(source, player) destroyElement(source) setElementData(player, "bike", false) end, 100, 1, source, player) end) else outputChatBox ( "Voce nao pode pegar duas Bikes ao mesmo tempo!", player, 255,0,0, true) end end end addCommandHandler("bikevip",givebike) 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