#RooTs Posted July 6, 2015 Share Posted July 6, 2015 Hi friends. The thing is, the idea of this script is that. when I'm downloading the server I can use the command / bike to pick up the bike or other vehicle. after I finish the server download it blocks the command, giving notice that I can no longer use command. only that this is not happening. I'm on download and the warning comes for me not allowing the use of the command. What I did wrong ?, there is error in the debug and Warnings Obs* sorry my english Server local Veiculos = {522} -- IDs dos Veículos. RooTs = {} function Create (source) if getElementData (source, "DownMOD") then -- inicio if getElementData (source, "Pegou", true) then outputChatBox ('#FF7300Aguarde #ffffff20 #FF7300segundos para pegar novamente.',source,255,255,255,true) return end if isElement(RooTs[source]) then destroyElement (RooTs[source]) RooTs[source] = nil end local x,y,z = getElementPosition (source) local Cars = Veiculos[math.random(#Veiculos)] RooTs[source] = createVehicle (Cars,x,y,z) warpPedIntoVehicle (source,RooTs[source]) outputChatBox ('#000000.:║ #00FF7FVEICULO #000000║:. - #FFFFFF'..getPlayerName(source)..' #6C6C6CPegou uma Moto digitando #00FF7F/moto', root, 255, 255, 255, true) setElementData (source, "Pegou",true) setTimer ( function() setElementData (source, "Pegou",false) end, 20000, 1 ) else outputChatBox ('#ff0000[Aviso] #6C6C6Co download já foi feito e #00FF7Fvocê #6C6C6Cnão pode usar o comando de novo', source, 255, 255, 255, true) end end addCommandHandler ("moto", Create) function DestroyVeiculo () destroyElement (RooTs[source]) end addEventHandler ("onPlayerLogout", root, DestroyVeiculo) addEventHandler ("onPlayerQuit", root, DestroyVeiculo) addEventHandler ("onPlayerWasted", root, DestroyVeiculo) addEventHandler ( "onVehicleExplode", resourceRoot, function ( ) destroyElement ( source ) end ) function onJoin() setElementData ( source, "DownMOD", false ) end addEventHandler("onPlayerJoin",root,onJoin) function onDownloadFinish() setElementData ( client, "DownMOD'", true ) end addEvent("DownLoad",true) addEventHandler("DownLoad",root,onDownloadFinish) Client addEventHandler("onClientResourceStart",resourceRoot, function() triggerServerEvent("DownLoad",getLocalPlayer()) end ) Link to comment
Calculador Posted July 6, 2015 Share Posted July 6, 2015 Amh, you can use this event instead of onClientResourceStart onClientFileDownloadComplete Link to comment
#RooTs Posted July 6, 2015 Author Share Posted July 6, 2015 Amh, you can use this event instead of onClientResourceStart onClientFileDownloadComplete No work Link to comment
joaosilva099 Posted July 6, 2015 Share Posted July 6, 2015 onPlayerJoin will only trigger when all resources are started clientside, so try changing onPlayerJoin with onPlayerConnect Do not forget to fade in the camera and focus it on the player who joined fadeCamera(source, true) setCameraTarget(source, source) onClientFileDownloadComplete won't work since it's meant to be used with downloadFile function and not with server scripts Link to comment
Calculador Posted July 7, 2015 Share Posted July 7, 2015 onPlayerJoin will only trigger when all resources are started clientside, so try changing onPlayerJoin with onPlayerConnectDo not forget to fade in the camera and focus it on the player who joined fadeCamera(source, true) setCameraTarget(source, source) onClientFileDownloadComplete won't work since it's meant to be used with downloadFile function and not with server scripts Yes but i suggested this event because this is triggered when a file has been downloaded after downloadFile has been successfully called and he wants that when the script starts the command no work. Link to comment
t3wz Posted July 7, 2015 Share Posted July 7, 2015 well, maybe smth like this ? function checkDownload () if not isTransferBoxActive() then triggerServerEvent( "DownLoad",getLocalPlayer() ) else setTimer ( checkDownload, 5 * 1000, 1 ) end end setTimer ( checkDownload, 5 * 1000, 1 ) function onJoin() setElementData ( source, "DownMOD", true ) end addEventHandler("onPlayerJoin",root,onJoin) function onDownloadFinish() setElementData ( client, "DownMOD'", false ) end addEvent("DownLoad",true) addEventHandler("DownLoad",root,onDownloadFinish) 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