Jump to content

Hadif

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by Hadif

  1. Hey guys, I have made a script that spawn a player when player logs in. But, it is not working and the debug console not show any errors. Any help will be appreciate, thank you! Script: addEventHandler ( "onPlayerLogin", getRootElement ( ), function ( ) setPlayerSpawn ( ) end ) function setPlayerSpawn ( ) setPlayerSpawnPosition ( source ) end function setPlayerSpawnPosition ( player ) local positions = { { -894.90002, 1963, 0.6, 14 }, { -893.40002, 1963.4, 60.6, 14 }, { -891.79999, 1963.8, 60.6, 14 } } local randomize = math.random ( 1, #positions ) spawnPlayer ( player, positions [ randomize ] [ 1 ], positions [ randomize ] [ 2 ], positions [ randomize ] [ 3 ], positions [ randomize ] [ 4 ] ) end
  2. Anyway, thanks for your help again!
  3. Never mind, i got the solution! function callAddon ( ) for index, resource in ipairs ( getResources ( ) ) do if getResourceInfo ( resource, "addon" ) == "letsdrive" then startResource ( resource ) end end end
  4. I get an error! Anyway, thank you for response. Debug: 7: Bad argument @ 'startResource' [Expected resource-data at argument 1, got string 'letsdrive'] Now, how do I fix this?
  5. I want to make a script that start some resources if the resource got info, 'addon = "letsdrive"'. Example: meta.xml: <info author="Hadif" version="1.0" name="Data" type="misc" addon="letsdrive" /> Any help will be appreciate! * PS: Letsdrive is the gamemode name. Script (server-side): function callAddon ( ) local resources = getResources ( ) for index, resources in ipairs ( resources ) do local resource = getResourceInfo ( resources, "addon" ) if ( resource == "letsdrive" ) then for index, resource in ipairs ( resource ) do startResource ( resource ) end end end end Debug: 6: bad argument #1 to 'ipairs' (table expected, got string)
  6. Finally, it works! Thank you guys for helping me!
  7. Can you help me fix my problem, my brain is stuck right now.
  8. addEventHandler ( "onClientResourceStart", resourceRoot, local theVehicle = getElementsByType ( "vehicle" ) function ( ) setTimer ( function ( ) for theKey, theVehicle in ipairs ( theVehicle ) do if isElementInWater ( theVehicle ) then blowVehicle ( theVehicle ) end end end, 30000, 0 ) end ) Do you think this would work? *I can't test it right now, 'couse it's time for me to sleep. Just want to get the answer fast when I awake from dream...
  9. thanks bro, i didnt know that the function is available..
  10. Anyone knows how to make a script that blow a car if the car drown into the water for 60 second? Please help, I can't find the solution. Thank you!
  11. no dude, i want it to change its numplate after respawn... eg: before "DRIVE 12", after respawn "DRIVE 94"
  12. yes, i want it to change the car numplate after it has been respawn, im glad u understand me....
  13. Someone knows how to reset randomize plate number when vehicle explode... eg: My car plate number is "ABC123", when my car explode, it change the plate number randomly to something else like "DEF456" or something... please help me, i ll try so many way but not find the solution... addEventHandler ( "onResourceStart", getRootElement ( ), function ( ) vehicleSpawn ( ) end ) addEventHandler ( "onVehicleExplode", getRootElement ( ), function ( ) respawnExplodedVehicle ( ) end ) local defaultPlate = "GUEST " .. math.random ( 11, 99 ) function vehicleSpawn ( ) local theVehicle = { } theVehicle [ 1 ] = createVehicle ( 558, -301.7, 1767.8, 42.4, 0, 0, 88, defaultPlate, false, variant1, variant2 ) local allVehicles = theVehicle for theKey, allVehicles in ipairs ( allVehicles ) do setElementData ( allVehicles, "Owner", "Free", true ) end end function respawnExplodedVehicle ( ) if ( getElementData ( source, "Owner" ) == "Free" ) then setTimer ( respawnVehicle, 5000, 1, source ) end end
  14. Ok sir, no more! Coz I already hv the solution.
  15. thank you very very very much sande... i appreciate yr help , may god bless you and keep you! feel free to join my server soon!
  16. Script: (Server) function theLocator() local allLocation = {"Las Venturas", "San Fierro", "Whetstone", "Flint County", "Red County", "Los Santos"} local theLocation = getElementZoneName(source, true) for theKey, allLocation in ipairs(allLocation) do if (theLocation == allLocation) then killPed(source) end end end setTimer(theLocator, 1000, 0) Debug: Bad argument @ 'getElementZoneName' [Expected element at argument 1, got nil]
  17. I think the problem is at the element(player) ...but I still didnt find the answer
  18. LoL ... I really need this bro T_T
  19. You don't need to add a function statement for function inside a timer and also you don't need to add even parenthesis of a function inside a timer. If the function has arguments then you can declare them later. @ You are assigning an argument to an argumentless function. function checkLocation() setTimer(theLocator(source), 0, 0) -- There are no arguments in theLocator end This should probably work: setTimer(theLocator, 0, 0) ]STILL NOT WORKING![/color]
  20. You don't need to add a function statement for function inside a timer and also you don't need to add even parenthesis of a function inside a timer. If the function has arguments then you can declare them later. @ You are assigning an argument to an argumentless function. function checkLocation() setTimer(theLocator(source), 0, 0) -- There are no arguments in theLocator end This should probably work: setTimer(theLocator, 0, 0) Thanks!
×
×
  • Create New...