Jump to content

Drakath

Members
  • Posts

    768
  • Joined

  • Last visited

Everything posted by Drakath

  1. Can client-side return a value without triggering a server-side function again? For example, I execute a server-side function in which I need to get a distance between two objects. I trigger a client-side event which calculates the distance but how can it return that distance to my server-side function without triggering the whole function again?
  2. Does the last file stated in the script downloads lastly? downloadFile("1.txd") downloadFile("2.png") downloadFile("3.png") downloadFile("4.dff") downloadFile("5.png") Will 5.png download lastly even though 4.dff size is a lot bigger? Will 1.txd download first?
  3. Hmm. I rather store all the files in a table. Thanks for the help.
  4. Is there a way to loop through a folder to see its files? Let's say I have a bunch of images in a folder and I want to get the name of each image.
  5. Thanks but no thanks. I already tried it but since there are thousands of sounds, I would be glad to find some sort of list of each sound with its name. All I found was a list of sounds in samp wiki but weapon sounds aren't listed in there.
  6. Drakath

    Draw distance

    How does GTA:SA handle LoD? Does it use gpu or cpu for it?
  7. Is there a way to check if data is resource-data? If no then is it possible to see which event has triggered a function?
  8. There is no way to stop the timer from resetting but you could use element data to see if the player did get his reward or how much time he has left.
  9. local pending_vehicles = { } local skinmechanic = { [ 50 ] = true } addEvent( getResourceName( resource ) .. ":accepted", true ) addEventHandler( getResourceName( resource ) .. ":accepted", root, function( ) local vehicle = getPedOccupiedVehicle( client ) if ( not vehicle ) or ( getPedOccupiedVehicleSeat( client ) ~= 1 ) or ( not skinmechanic[ getElementModel( client ) ] ) then return end local driver = getVehicleController( vehicle ) if ( getElementType( driver ) == "player" ) then if ( getElementHealth( vehicle ) < 800 ) then fadeCamera( source, false, 1.0 ) setTimer( function( vehicle, source ) if ( isElement( vehicle ) ) and ( getElementHealth( vehicle ) < 800 ) then givePlayerMoney( source, 3000 ) fixVehicle( vehicle ) end if ( pending_vehicles[ source ] ) then pending_vehicles[ source ] = nil end fadeCamera( source, true, 1.0 ) end, 2500, 1, vehicle, source ) else outputChatBox( "Error: The vehicle is already in good condition.", source, 255, 0, 0, false ) end end end ) local vehicle_types = { [ "Automobile" ] = true, [ "Helicopter" ] = true, [ "Monster Truck" ] = true } addEventHandler( "onPlayerVehicleEnter", root, function( vehicle, seat, jacked ) if ( jacked ) or ( not skinmechanic[ getElementModel( source ) ] ) or ( not vehicle_types[ getVehicleType( vehicle ) ] ) or ( seat ~= 1 ) then return end local driver = getVehicleController( vehicle ) if ( driver ) and ( getElementType( driver ) == "player" ) then playSoundFrontEnd( source, 40 ) pending_vehicles[ source ] = driver triggerClientEvent( driver, getResourceName( resource ) .. ":display", source ) end end ) addEventHandler( "onPlayerVehicleStartExit", root, function( vehicle ) if ( not skinmechanic[ getElementModel( source ) ] ) or ( not vehicle_types[ getVehicleType( vehicle ) ] ) then return end if ( pending_vehicles[ source ] ) and ( isElement( pending_vehicles[ source ] ) ) then triggerClientEvent( pending_vehicles[ source ], getResourceName( resource ) .. ":display", source, false ) pending_vehicles[ source ] = nil end end )
  10. Any idea which groups should I disable in order to mute every weapon that shoots sound?
  11. And what is the the group for gun fire?
  12. Drakath

    registry.db

    Databases do not need to be reloaded. You access them directly.
  13. Is the gun fire option really working? I tried this but I can still hear the shooting noise. function soundOff() setAmbientSoundEnabled( "gunfire", false ) end addCommandHandler("off", soundOff)
  14. Great, I will start using local functions most of the time now. Thanks for the information.
  15. Yeah, I know but I heard that using local makes it faster and uses less memory or something. I wonder if that's true.
  16. If I have one script in my resource, is it more efficient to use: local function() ?
  17. You could try this. function update(thePreviousAccount, theCurrentAccount) triggerClientEvent ( "updateGuis", getRootElement(), theCurrentAccount ) end addEventHandler("onPlayerLogin", root, update)
  18. triggerClientEvent triggerServerEvent triggerEvent
  19. I'm not sure how it was back in 2011 but VMware works fine now. I was playing MTA:SA with VMware Player (Windows 7 Ultimate x86) and I did not encounter a single problem.
  20. Source is the player who triggered the event. I think what you want is to get the account with a specific username. getAccount
  21. He basically wrote the whole code. Just put it in a function and addEventHandler. onPlayerWasted
  22. It is not suppose to set kills. Something is probably wrong with your script which sets the kills.
  23. When correctQuiz() is called you guiSetVisible( quizWindow, false ) which makes your window disappear. So you should add if source == quizFinish then
×
×
  • Create New...