devildead622 Posted March 16, 2013 Posted March 16, 2013 to make of this? addEventHandler('onVehicleExit',veh,function() setTimer ( function() destroyElement( veh ) setElementData(player, "bike", false) end, 100, 1 ) end)
devildead622 Posted March 16, 2013 Author 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)
TAPL Posted March 16, 2013 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)
devildead622 Posted March 16, 2013 Author 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)
devildead622 Posted March 16, 2013 Author Posted March 16, 2013 how so? destroyElement(source) should not be this? destroyElement(veh)
devildead622 Posted March 16, 2013 Author Posted March 16, 2013 function(player) setTimer(function(veh, player) destroyElement(veh) setElementData(player, "bike", false) end, 100, 1, veh, player) end) this?
iPrestege Posted March 16, 2013 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?
TAPL Posted March 16, 2013 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)
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