Jump to content

TorNix~|nR

Members
  • Posts

    503
  • Joined

  • Last visited

Everything posted by TorNix~|nR

  1. TorNix~|nR

    Antiveh

    Hello guys I have a problem in this script, it said line: 9 Expected function at argument 3, got nil, any help please? local colPositions = { {96.24, 1808.96, 230, 150}, } local createdCols = {} for i, k in pairs(colPositions) do local tCol = createColRectangle(k[1], k[2], k[3], k[4]) -- Creating the col at the position with the fix width and height. addEventHandler("onColShapeHit", tCol, destroyTheVehicles) -- Adding the "onColShapeHit" event to the created col. table.insert(createdCols, tCol) -- Adding the created col to the "createdCols" table. end function cancelEnter(thePlayer) for i, k in pairs(createdCols) do -- Looping through the created cols. if isElementWithinColShape(thePlayer, k) then -- Checking if the player is inside one. destroyElement(source) -- If he is. outputChatBox("Vehicles are not allowed here!", thePlayer, 255, 0, 0) break end end end addEventHandler("onVehicleStartEnter", root, cancelEnter) function destroyTheVehicles(player) if getElementType(player) == "player" and isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) removePedFromVehicle(player) respawnVehicle(vehicle) outputChatBox("Vehicles are not allowed here!", player, 255, 0, 0) end end
  2. TorNix~|nR

    Shader

    Guys how can I make fire shader? I have the fx and a png of the fire, I want to make it shader, but I don't know how help please
  3. @Senator3532, Он сказал вам отправить ему личное сообщение
  4. It's working, thank you so much ^ _ ^
  5. Hey guys, please I want help, why this doesn't work local vehicle = getPedOccupiedVehicle(player) local occupants = getVehicleOccupants(vehicle) removePedFromVehicle ( occupants )
  6. Thank you so much @Abdul KariM, jaazak allah ^^
  7. TorNix~|nR

    Question

    Hey guys, I used this on my script removePedFromVehicle it only removes the player who is driving, I want to remove all players inside the vehicle, any help please?
  8. Thank you so much, I already told you I don't know how to make a table, from now on, I can ty
  9. I know I can use more event handlers, but I want to make it more easy, and not a big code like this for example local cols = { {667.73, 1850.39, 50, 50}, -- First location {1667.73, 1050.39, 100, 100}, -- Second location } but I don't know how to do it inside the code, help please?
  10. Working fine Thank you, but how can I make more cols, not just 1, I know I should use the table but I don't know how? help please?
  11. I know, but I don't know how to use it onVehicleStartEnter help please?
  12. Hello guys, I have this script working fine, when you join with a vehicle to zone, it will be automatically respawned and you will get out of it but when you are on zone, you can get into the vehicles, I want even when you are inside the zone and spawn a vehicle, you will can not use it help please Code local myCol = createColRectangle (667.73, 1850.39, 50, 50) function destroyTheVehicles (player) if getElementType (player) == "player" and isPedInVehicle (player) then local vehicle = getPedOccupiedVehicle(player) removePedFromVehicle(player) respawnVehicle(vehicle) outputChatBox ("Vehicles are not allowed here!", player, 255, 0, 0) end end addEventHandler ("onColShapeHit", myCol, destroyTheVehicles)
  13. TorNix~|nR

    Editor

    Hello guys, I made a base with editor script, I made a base in the water ( I mean little bit up (not inside the water) ) I added vehicles, when I use that base, sometimes the vehicles fall down to water (from the base to the water), I don't know why, I think it's a bug from the script help please?
  14. Try to download the simple dx scoreboard from the community and make sure the admin panel file is named admin inside [admin] Like I told you, the code I gave you is working, try and tell me
  15. Use /debugscript 3, and tell us Use this server-side on your script function showcountry() local flag = exports.admin:getPlayerCountry ( source ) if flag then setElementData(source,"Country",":admin/client/images/flags/"..flag..".png") else flag = "N/A" end end addEventHandler("onPlayerJoin",getRootElement(),showcountry) add it on admin panel, use resource."yourfoldername" and use this scoreboard code elseif column.name == "Country" then dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) That should 100% work, because I tested it PS: do not forget to add this on scoreboard exports { ["name"] = "Country", ["width"] = 16, ["friendlyName"] = "Country", ["priority"] = 1 }, --add your placement instead of "1" Tell me if you got a problem
  16. TorNix~|nR

    Safe zone

    Hello guys, I have my script, a safe zone when a player enters the safe zone, of course he can't kill players, but the problem is that all the damage are disabled he have like a godmode EXAMPLE: when a players falls from a long distance, he never get damaged, I want to disable this I want the player get damaged, but not from players help me please Client side addEventHandler( 'onClientPlayerDamage', localPlayer, function(attacker) if getElementData(attacker,"dd") == true then return end if getElementData( localPlayer, 'damage' ) == 'no' then cancelEvent( ) end end )
  17. Thank you so much @DNL291, I really appreciate it
  18. Guys, I can't do it, please help me this is my full code Client side -- Some stats local isPumping = false local fuelPrice = 5 local currentMarker local doEventHandlers -- When the player enters a vehicle addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer, seat ) if ( thePlayer == localPlayer ) and ( seat == 0 ) then if ( fuelTimer ) and ( isTimer( fuelTimer ) ) then killTimer( fuelTimer ) end if not ( getElementData ( source, "vehicleFuel" ) ) then setElementData ( source, "vehicleFuel", 100 ) elseif ( getElementData ( source, "vehicleFuel" ) <= 0 ) then disableVehicleFunctions( source ) else enableVehicleFunctions( source ) end if ( doEventHandlers ) then addEventHandler ( "onClientVehicleExit", source, onVehicleExitDestroy, false ) addEventHandler ( "onClientElementDestroy", source, onVehicleExitDestroy, false ) doEventHandlers = false end fuelTimer = setTimer ( onDecreaseFuel, 7000, 0 ) end end ) -- Disable all vehicle functions whenever the vehicle has no fuel left function disableVehicleFunctions ( theVehicle ) if ( fuelTimer ) and ( isTimer( fuelTimer ) ) then killTimer( fuelTimer ) end setVehicleEngineState( theVehicle, false ) toggleControl ( "accelerate", false ) toggleControl ( "brake_reverse", false ) outputChatBox( "This vehicle has stopped fuel, call a mechanic to refuel!", 0, 225, 0 ) end -- Enable the vehicle functions again function enableVehicleFunctions( theVehicle ) setVehicleEngineState( theVehicle, true ) toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) end -- When the resource starts addEventHandler ( "onClientResourceStart", resourceRoot, function () if ( getPedOccupiedVehicle ( localPlayer ) ) and ( getVehicleOccupant ( getPedOccupiedVehicle ( localPlayer ), 0 ) == localPlayer ) then doEventHandlers = true local theVehicle = getPedOccupiedVehicle ( localPlayer ) if not ( getElementData ( theVehicle, "vehicleFuel" ) ) then setElementData ( theVehicle, "vehicleFuel", 100 ) elseif ( getElementData ( theVehicle, "vehicleFuel" ) <= 0 ) then disableVehicleFunctions( theVehicle ) end if ( doEventHandlers ) then addEventHandler ( "onClientVehicleExit", root, onVehicleExitDestroy, false ) addEventHandler ( "onClientElementDestroy", root, onVehicleExitDestroy, false ) doEventHandlers = false end fuelTimer = setTimer ( onDecreaseFuel, 5000, 0 ) end end ) -- Function when a vehicle gets destroyed or when a player exit the vehicle function onVehicleExitDestroy ( theVehicle ) local theVehicle = theVehicle or source if ( fuelTimer ) and ( isTimer( fuelTimer ) ) then killTimer( fuelTimer ) end if ( getElementData ( theVehicle, "vehicleFuel" ) ) then setElementData ( theVehicle, "vehicleFuel", getElementData ( theVehicle, "vehicleFuel" ) ) end unbindKey ( "K", "down", onRefuelVehicle ) unbindKey ( "K", "up", onStopRefuelVehicle ) isPumping = false if ( theVehicle ) then removeEventHandler ( "onClientVehicleExit", theVehicle, onVehicleExitDestroy, false ) removeEventHandler ( "onClientElementDestroy", theVehicle, onVehicleExitDestroy, false ) doEventHandlers = true end end -- When the resource gets stopped addEventHandler ( "onClientResourceStop", resourceRoot, function () if ( getPedOccupiedVehicle ( localPlayer ) ) and ( getVehicleOccupant ( getPedOccupiedVehicle ( localPlayer ), 0 ) == localPlayer ) then onVehicleExitDestroy ( getPedOccupiedVehicle ( localPlayer ) ) end end ) -- Function that decreases the fuel function onDecreaseFuel () local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle ) then local theFuel = getElementData ( theVehicle, "vehicleFuel" ) if ( theFuel ) and not ( isPumping ) and ( getVehicleEngineState ( theVehicle ) ) and ( theFuel > 0 ) and ( getVehicleOccupant ( getPedOccupiedVehicle ( localPlayer ), 0 ) == localPlayer ) then setElementData ( theVehicle, "vehicleFuel", theFuel - 1 ) if ( getElementData ( theVehicle, "vehicleFuel" ) <= 0 ) then disableVehicleFunctions( theVehicle ) end end end end -- Get the vehicle speed function getVehicleSpeed ( theVehicle, unit ) if ( unit == nil ) then unit = 0 end if ( isElement( theVehicle ) ) then local x,y,z = getElementVelocity( theVehicle ) if ( unit=="mph" or unit==1 or unit =='1' ) then return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 else return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 end else return false end end -- When the player hits a fuel marker function onFuelPumpMarkerHit ( hitElement, matchingDimension, theMarker ) local theMarker = theMarker or source if ( hitElement ) and ( getElementType ( hitElement ) == "player" ) and ( matchingDimension ) and ( getPedOccupiedVehicle( hitElement ) ) and ( isFuelMarker ( theMarker ) ) and ( getVehicleController( getPedOccupiedVehicle( hitElement ) ) == localPlayer ) then local theVehicle = getPedOccupiedVehicle( hitElement ) if ( getElementData( theVehicle, "vehicleFuel" ) >= 100 ) then outputChatBox ( "Your vehicle has enough fuel!", 225, 0, 0 ) else currentMarker = theMarker bindKey ( "K", "down", onRefuelVehicle ) outputChatBox ( "Press 'K' if you want to refuel.", 0, 255, 0 ) end end end -- When the player hits a fuel marker function onFuelPumpMarkerLeave ( hitElement, matchingDimension ) if ( hitElement == localPlayer ) then unbindKey ( "K", "down", onRefuelVehicle ) unbindKey ( "K", "up", onStopRefuelVehicle ) isPumping = false end end -- When the player press the space button to refuell function onRefuelVehicle () if ( getPedOccupiedVehicle( localPlayer ) ) then local theVehicle = getPedOccupiedVehicle( localPlayer ) setElementFrozen ( theVehicle, true ) if ( getVehicleSpeed ( theVehicle, "kmh" ) >= 1 ) then outputChatBox ( "Please bring the vehicle to a complete stop!", 225, 0, 0 ) elseif ( getPlayerMoney() < fuelPrice ) then outputChatBox ( "You do not have enough money, the price is $" .. fuelPrice .." per litre!", 255, 0, 0 ) else local oldFuel = math.floor( getElementData ( theVehicle, "vehicleFuel" ) ) setTimer ( onRefillVehicle, 250, 1, theVehicle, oldFuel ) outputChatBox ( "Your vehicle is being filled, please wait...", 0, 255, 0 ) isPumping = true unbindKey ( "K", "down", onRefuelVehicle ) bindKey ( "K", "up", onStopRefuelVehicle ) end else onStopRefuelVehicle () end end -- Actualy refill the vehicle function onRefillVehicle( theVehicle, oldFuel, price ) if ( theVehicle ) and ( oldFuel ) then local theFuel = tonumber( oldFuel ) local thePrice = tonumber( price ) or 0 if not ( getKeyState ( "K" ) ) then onStopRefuelVehicle ( theFuel, thePrice, theVehicle ) elseif ( getPlayerMoney() < fuelPrice ) and not ( getElementData( theVehicle, "vehicleOccupation" ) ) then outputChatBox ( "You do not have enough money to continue, the price is $" .. fuelPrice .." per litre!", 255, 0, 0 ) onStopRefuelVehicle ( theFuel, thePrice, theVehicle ) elseif ( oldFuel >= 100 ) then onStopRefuelVehicle ( theFuel, thePrice, theVehicle ) else theFuel = math.floor( theFuel + 1 ) thePrice = math.floor( thePrice + 5 ) setTimer ( onRefillVehicle, 250, 1, theVehicle, theFuel, thePrice ) setElementData ( theVehicle, "vehicleFuel", theFuel ) end end end -- When the player stops pressing space or stop fuel function onStopRefuelVehicle ( theFuel, thePrice, theVehicle ) unbindKey ( "K", "up", onStopRefuelVehicle ) isPumping = false local theVehicle = getPedOccupiedVehicle( localPlayer ) local newFreezeStatus = not currentFreezeStatus setElementFrozen ( theVehicle, false ) if ( theFuel ) and ( thePrice ) and not ( tostring( theFuel ) == "space" ) then if ( tonumber( theFuel ) < 100 ) then bindKey ( "K", "down", onRefuelVehicle ) outputChatBox ( "Press 'K' if you want to refuel more.", 225, 0, 0 ) end if ( theVehicle ) and ( getElementData( theVehicle, "vehicleOccupation" ) ) then outputChatBox ( "The company, he works for pays its fuel, lucky bastard.", 0, 255, 0 ) else triggerServerEvent ( "onPlayerPaymentFuel", localPlayer, thePrice ) if ( thePrice ) then outputChatBox ( "You paid $" .. thePrice .. " for recharging!", 0, 255, 0 ) end end end end Server side -- Event that let the drive pay for the refueling addEvent ( "onPlayerPaymentFuel", true ) addEventHandler ( "onPlayerPaymentFuel", root, function ( thePrice ) takePlayerMoney ( source, thePrice ) end ) -- Exports to set vehicle fuel function setVehicleFuel ( theVehicle, theFuel ) if ( theVehicle ) and ( isElement( theVehicle ) ) and ( theFuel ) then setElementData ( theVehicle, "vehicleFuel", theFuel ) return true else return false end end -- Exports to get vehicle fuel function getVehicleFuel ( theVehicle ) if ( theVehicle ) and ( isElement( theVehicle ) ) then return getElementData ( theVehicle, "vehicleFuel" ) else return false end end Help me please guys
  19. Didn't work, I even used this if getVehicleType(source) ~= 'BMX' and getVehicleType(source) ~= 'Bike' and getVehicleType(source) ~= 'Mountain Bike' and getVehicleType(source) ~= 'Quad' then return end and it's the same, help please?
  20. Hey guys, please can anyone help me? my fuelsystem I want to disable the bikes on fuelsystem bike ids: 510, 509, 481 help me please Server-Side -- Event that let the drive pay for the refueling addEvent ( "onPlayerPaymentFuel", true ) addEventHandler ( "onPlayerPaymentFuel", root, function ( thePrice ) takePlayerMoney ( source, thePrice ) end ) -- Exports to set vehicle fuel function setVehicleFuel ( theVehicle, theFuel ) if ( theVehicle ) and ( isElement( theVehicle ) ) and ( theFuel ) then setElementData ( theVehicle, "vehicleFuel", theFuel ) return true else return false end end -- Exports to get vehicle fuel function getVehicleFuel ( theVehicle ) if ( theVehicle ) and ( isElement( theVehicle ) ) then return getElementData ( theVehicle, "vehicleFuel" ) else return false end end
  21. It start destroying zombies, I think I give up Thank you so much ^^
×
×
  • Create New...