Jump to content

Marker script


Nerses

Recommended Posts

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

You're being very inconclusive, wich machine? wich settings? where? how? what?

Sorry, I have a bad English. Need a script that when a car drove up and began to the marker that automatically changed the characteristics of the machine are the ones that I ask.

Link to comment
  • 4 months later...

try to check the setVehicleHandling function on the wiki and learn about it.

once you're done create a marker here's an example of a marker , when a player hits the marker , it triggers the server event , this is client side, just change the marker x y z and what kind of settings on the machine you want?

Client.lua

local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
addEventHandler("onClientMarkerHit", marker, function(player) 
         if (player == localPlayer) then 
         triggerServerEvent ("vehiclehandling",getLocalPlayer(),vehiclehandling) 
         end 
 end) 
  

here's an example that changes the car to very fast and damage proof from col , i copied the handlings on the wiki.(pardon if i have anything wrong , i'm kinda tired right now)

Server.lua

addEvent("vehiclehandling",true)  
addEventHandler("vehiclehandling",root,  
function() 
   if ( getPlayerMoney (source) >= 0 ) then 
    takePlayerMoney(source, 0) 
    setVehicleHandling(source, "mass", 300.0) 
    setVehicleHandling(source, "turnMass", 200) 
    setVehicleHandling(source, "dragCoeff", 4.0 ) 
    setVehicleHandling(source, "centerOfMass", { 0.0,0.08,-0.09 } ) 
    setVehicleHandling(source, "percentSubmerged", 103) 
    setVehicleHandling(source, "tractionMultiplier", 1.7) -- you can also put 1.8 
    setVehicleHandling(source, "tractionLoss", 1.0) 
    setVehicleHandling(source, "tractionBias", 0.48) 
    setVehicleHandling(source, "numberOfGears", 5) 
    setVehicleHandling(source, "maxVelocity", 300.0) 
    setVehicleHandling(source, "engineAcceleration", 90.0 ) 
    setVehicleHandling(source, "engineInertia", 5.0) 
    setVehicleHandling(source, "driveType", "rwd") 
    setVehicleHandling(source, "engineType", "petrol") 
    setVehicleHandling(source, "brakeDeceleration", 20.0) 
    setVehicleHandling(source, "brakeBias", 0.60) 
    setVehicleHandling(source, "steeringLock",  35.0 ) 
    setVehicleHandling(source, "suspensionForceLevel", 0.85) 
    setVehicleHandling(source, "suspensionDamping", 0.15 ) 
    setVehicleHandling(source, "suspensionHighSpeedDamping", 0.0) 
    setVehicleHandling(source, "suspensionUpperLimit", 0.15 ) 
    setVehicleHandling(source, "suspensionLowerLimit", -0.16) 
    setVehicleHandling(source, "suspensionFrontRearBias", 0.5 ) 
    setVehicleHandling(source, "suspensionAntiDiveMultiplier", 0.0) 
    setVehicleHandling(source, "seatOffsetDistance", 0.0) 
    setVehicleHandling(source, "collisionDamageMultiplier", 0.00) 
    setVehicleHandling(source, "monetary",  10000) 
    setVehicleHandling(source, "modelFlags", 1002000) 
    setVehicleHandling(source, "handlingFlags", 1000002) 
    setVehicleHandling(source, "headLight", 3) 
    setVehicleHandling(source, "tailLight", 2) 
    setVehicleHandling(source, "animGroup", 4) 
end 
end) 

Edited by Guest
Link to comment
try to check the setVehicleHandling function on the wiki and learn about it.

once you're done create a marker here's an example of a marker , when a player hits the marker , it triggers the server event , this is client side, just change the marker x y z and what kind of settings on the machine you want?

local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
addEventHandler("onClientMarkerHit", marker, function(player) 
         if (player == localPlayer) then 
         triggerServerEvent ("vehiclehandling",getLocalPlayer(),vehiclehandling) 
         end 
 end) 
  

here's an example that changes the car to very fast and damage proof from col , i copied the handlings on the wiki.(pardon if i have anything wrong , i'm kinda tired right now)

addEvent("vehiclehandling",true)  
addEventHandler("vehiclehandling",root,  
function() 
   if ( getPlayerMoney (source) >= 0 ) then 
    takePlayerMoney(source, 0) 
    setVehicleHandling(source, "mass", 300.0) 
    setVehicleHandling(source, "turnMass", 200) 
    setVehicleHandling(source, "dragCoeff", 4.0 ) 
    setVehicleHandling(source, "centerOfMass", { 0.0,0.08,-0.09 } ) 
    setVehicleHandling(source, "percentSubmerged", 103) 
    setVehicleHandling(source, "tractionMultiplier", 1.7) -- you can also put 1.8 
    setVehicleHandling(source, "tractionLoss", 1.0) 
    setVehicleHandling(source, "tractionBias", 0.48) 
    setVehicleHandling(source, "numberOfGears", 5) 
    setVehicleHandling(source, "maxVelocity", 300.0) 
    setVehicleHandling(source, "engineAcceleration", 90.0 ) 
    setVehicleHandling(source, "engineInertia", 5.0) 
    setVehicleHandling(source, "driveType", "rwd") 
    setVehicleHandling(source, "engineType", "petrol") 
    setVehicleHandling(source, "brakeDeceleration", 20.0) 
    setVehicleHandling(source, "brakeBias", 0.60) 
    setVehicleHandling(source, "steeringLock",  35.0 ) 
    setVehicleHandling(source, "suspensionForceLevel", 0.85) 
    setVehicleHandling(source, "suspensionDamping", 0.15 ) 
    setVehicleHandling(source, "suspensionHighSpeedDamping", 0.0) 
    setVehicleHandling(source, "suspensionUpperLimit", 0.15 ) 
    setVehicleHandling(source, "suspensionLowerLimit", -0.16) 
    setVehicleHandling(source, "suspensionFrontRearBias", 0.5 ) 
    setVehicleHandling(source, "suspensionAntiDiveMultiplier", 0.0) 
    setVehicleHandling(source, "seatOffsetDistance", 0.0) 
    setVehicleHandling(source, "collisionDamageMultiplier", 0.00) 
    setVehicleHandling(source, "monetary",  10000) 
    setVehicleHandling(source, "modelFlags", 1002000) 
    setVehicleHandling(source, "handlingFlags", 1000002) 
    setVehicleHandling(source, "headLight", 3) 
    setVehicleHandling(source, "tailLight", 2) 
    setVehicleHandling(source, "animGroup", 4) 
end 
end) 

create the marker is on the server side or client?

Link to comment

yes , on my code , the createmarker is client side

the client is the one with , onClientMarkerHit and triggerserverevent while the server is the setvehiclehandlings

you will know if where the function is compatible for , client function is red color while the server function is orange.

Link to comment
yes , on my code , the createmarker is client side

the client is the one with , onClientMarkerHit and triggerserverevent while the server is the setvehiclehandlings

you will know if where the function is compatible for , client function is red color while the server function is orange.

I did but I have not token icon on the map does not appear

Link to comment
yes , on my code , the createmarker is client side

the client is the one with , onClientMarkerHit and triggerserverevent while the server is the setvehiclehandlings

you will know if where the function is compatible for , client function is red color while the server function is orange.

the marker was able to create, now when I call it there is nothing does not change, what to do?

here is the error

[2015-05-08 22:03:21] WARNING: [gameplay]/qwerty/server.lua:37: Bad argument @ 'setVehicleHandling' [Expected vehicle at argument 1, got player]

Link to comment
alright let me deal with this.

client

local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
addEventHandler("onClientMarkerHit", marker, function(player) 
         if (player == localPlayer) then 
         triggerServerEvent ("vehiclehandling",getLocalPlayer(),vehiclehandling) 
         end 
 end) 
  
 local blip = createBlip( -1187.7109375, -1308.9765625,0, 55, 0, 0, 0, 0, 0, 0, 250) 
setBlipVisibleDistance(blip, 1500) -- 150 é a distancia perfeita 

meta

<meta> 
<info descirption="www.gta-arabs.com" type="script" name="safe zone" version="1.0" author="Co[L]a>3"/> 
<script src ="client.lua" type = "client" /> 
<script src ="server.lua" type = "server" /> 
</meta> 
  

server

addEvent("vehiclehandling",true) 
addEventHandler("vehiclehandling",root, 
function() 
   if ( getPlayerMoney (source) >= 0 ) then 
    takePlayerMoney(source, 0) 
    setVehicleHandling(source, "mass", 4500.0) 
    setVehicleHandling(source, "turnMass", 200) 
    setVehicleHandling(source, "dragCoeff", 4.0 ) 
    setVehicleHandling(source, "centerOfMass", { 0.0,0.08,-0.09 } ) 
    setVehicleHandling(source, "percentSubmerged", 103) 
    setVehicleHandling(source, "tractionMultiplier", 1.7) -- you can also put 1.8 
    setVehicleHandling(source, "tractionLoss", 1.0) 
    setVehicleHandling(source, "tractionBias", 0.48) 
    setVehicleHandling(source, "numberOfGears", 5) 
    setVehicleHandling(source, "maxVelocity", 300.0) 
    setVehicleHandling(source, "engineAcceleration", 90.0 ) 
    setVehicleHandling(source, "engineInertia", 5.0) 
    setVehicleHandling(source, "driveType", "rwd") 
    setVehicleHandling(source, "engineType", "petrol") 
    setVehicleHandling(source, "brakeDeceleration", 20.0) 
    setVehicleHandling(source, "brakeBias", 0.60) 
    setVehicleHandling(source, "steeringLock",  35.0 ) 
    setVehicleHandling(source, "suspensionForceLevel", 0.85) 
    setVehicleHandling(source, "suspensionDamping", 0.15 ) 
    setVehicleHandling(source, "suspensionHighSpeedDamping", 0.0) 
    setVehicleHandling(source, "suspensionUpperLimit", 0.15 ) 
    setVehicleHandling(source, "suspensionLowerLimit", -0.16) 
    setVehicleHandling(source, "suspensionFrontRearBias", 0.5 ) 
    setVehicleHandling(source, "suspensionAntiDiveMultiplier", 0.0) 
    setVehicleHandling(source, "seatOffsetDistance", 0.0) 
    setVehicleHandling(source, "collisionDamageMultiplier", 0.00) 
    setVehicleHandling(source, "monetary",  10000) 
    setVehicleHandling(source, "modelFlags", 1002000) 
    setVehicleHandling(source, "handlingFlags", 1000002) 
    setVehicleHandling(source, "headLight", 3) 
    setVehicleHandling(source, "tailLight", 2) 
    setVehicleHandling(source, "animGroup", 4) 
end 
end) 

Link to comment
well there is a solution to the problem?
local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
addEventHandler("onMarkerHit", marker,  
    function(player,matchDim) 
         if (matchDim and isElement(player) and getElementType(player) == "player" then ) then 
            if isPedInVehicle (player) then  
            local vehicle = getPedOccupiedVehicle(player) 
            VehicleHandling(player,vehicle) 
        end 
    end  
 end 
) 
  
  
function VehicleHandling(player,vehicle) 
    if isElement(player) and vehicle then  
        if ( getPlayerMoney (player) >= 0 ) then -- check the player money  
        takePlayerMoney(player, 0) -- put how much you will take here  
        setVehicleHandling(vehicle, "mass", 300.0) 
        setVehicleHandling(vehicle, "turnMass", 200) 
        setVehicleHandling(vehicle, "dragCoeff", 4.0 ) 
        setVehicleHandling(vehicle, "centerOfMass", { 0.0,0.08,-0.09 } ) 
        setVehicleHandling(vehicle, "percentSubmerged", 103) 
        setVehicleHandling(vehicle, "tractionMultiplier", 1.7) -- you can also put 1.8 
        setVehicleHandling(vehicle, "tractionLoss", 1.0) 
        setVehicleHandling(vehicle, "tractionBias", 0.48) 
        setVehicleHandling(vehicle, "numberOfGears", 5) 
        setVehicleHandling(vehicle, "maxVelocity", 300.0) 
        setVehicleHandling(vehicle, "engineAcceleration", 90.0 ) 
        setVehicleHandling(vehicle, "engineInertia", 5.0) 
        setVehicleHandling(vehicle, "driveType", "rwd") 
        setVehicleHandling(vehicle, "engineType", "petrol") 
        setVehicleHandling(vehicle, "brakeDeceleration", 20.0) 
        setVehicleHandling(vehicle, "brakeBias", 0.60) 
        setVehicleHandling(vehicle, "steeringLock",  35.0 ) 
        setVehicleHandling(vehicle, "suspensionForceLevel", 0.85) 
        setVehicleHandling(vehicle, "suspensionDamping", 0.15 ) 
        setVehicleHandling(vehicle, "suspensionHighSpeedDamping", 0.0) 
        setVehicleHandling(vehicle, "suspensionUpperLimit", 0.15 ) 
        setVehicleHandling(vehicle, "suspensionLowerLimit", -0.16) 
        setVehicleHandling(vehicle, "suspensionFrontRearBias", 0.5 ) 
        setVehicleHandling(vehicle, "suspensionAntiDiveMultiplier", 0.0) 
        setVehicleHandling(vehicle, "seatOffsetDistance", 0.0) 
        setVehicleHandling(vehicle, "collisionDamageMultiplier", 0.00) 
        setVehicleHandling(vehicle, "monetary",  10000) 
        setVehicleHandling(vehicle, "modelFlags", 1002000) 
        setVehicleHandling(vehicle, "handlingFlags", 1000002) 
        setVehicleHandling(vehicle, "headLight", 3) 
        setVehicleHandling(vehicle, "tailLight", 2) 
        setVehicleHandling(vehicle, "animGroup", 4) 
        end 
    end 
end  

Link to comment
well there is a solution to the problem?
local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
addEventHandler("onMarkerHit", marker,  
    function(player,matchDim) 
         if (matchDim and isElement(player) and getElementType(player) == "player" then ) then 
            if isPedInVehicle (player) then  
            local vehicle = getPedOccupiedVehicle(player) 
            VehicleHandling(player,vehicle) 
        end 
    end  
 end 
) 
  
  
function VehicleHandling(player,vehicle) 
    if isElement(player) and vehicle then  
        if ( getPlayerMoney (player) >= 0 ) then -- check the player money  
        takePlayerMoney(player, 0) -- put how much you will take here  
        setVehicleHandling(vehicle, "mass", 300.0) 
        setVehicleHandling(vehicle, "turnMass", 200) 
        setVehicleHandling(vehicle, "dragCoeff", 4.0 ) 
        setVehicleHandling(vehicle, "centerOfMass", { 0.0,0.08,-0.09 } ) 
        setVehicleHandling(vehicle, "percentSubmerged", 103) 
        setVehicleHandling(vehicle, "tractionMultiplier", 1.7) -- you can also put 1.8 
        setVehicleHandling(vehicle, "tractionLoss", 1.0) 
        setVehicleHandling(vehicle, "tractionBias", 0.48) 
        setVehicleHandling(vehicle, "numberOfGears", 5) 
        setVehicleHandling(vehicle, "maxVelocity", 300.0) 
        setVehicleHandling(vehicle, "engineAcceleration", 90.0 ) 
        setVehicleHandling(vehicle, "engineInertia", 5.0) 
        setVehicleHandling(vehicle, "driveType", "rwd") 
        setVehicleHandling(vehicle, "engineType", "petrol") 
        setVehicleHandling(vehicle, "brakeDeceleration", 20.0) 
        setVehicleHandling(vehicle, "brakeBias", 0.60) 
        setVehicleHandling(vehicle, "steeringLock",  35.0 ) 
        setVehicleHandling(vehicle, "suspensionForceLevel", 0.85) 
        setVehicleHandling(vehicle, "suspensionDamping", 0.15 ) 
        setVehicleHandling(vehicle, "suspensionHighSpeedDamping", 0.0) 
        setVehicleHandling(vehicle, "suspensionUpperLimit", 0.15 ) 
        setVehicleHandling(vehicle, "suspensionLowerLimit", -0.16) 
        setVehicleHandling(vehicle, "suspensionFrontRearBias", 0.5 ) 
        setVehicleHandling(vehicle, "suspensionAntiDiveMultiplier", 0.0) 
        setVehicleHandling(vehicle, "seatOffsetDistance", 0.0) 
        setVehicleHandling(vehicle, "collisionDamageMultiplier", 0.00) 
        setVehicleHandling(vehicle, "monetary",  10000) 
        setVehicleHandling(vehicle, "modelFlags", 1002000) 
        setVehicleHandling(vehicle, "handlingFlags", 1000002) 
        setVehicleHandling(vehicle, "headLight", 3) 
        setVehicleHandling(vehicle, "tailLight", 2) 
        setVehicleHandling(vehicle, "animGroup", 4) 
        end 
    end 
end  

does not work

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...