Jump to content

Marker script


Nerses

Recommended Posts

Posted

Good evening friends. Need your help. I need a script that for example when the player approached the marker on the machine, and for automatically changing the machine settings on the ones I ask. In advance thank you very much for your help.

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Posted

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

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
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.

Posted

You want to change the vehicle's handling if it hits a marker? In that case;

onMarkerHit 
setVehicleHandling 

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted
You want to change the vehicle's handling if it hits a marker? In that case;
onMarkerHit 
setVehicleHandling 

Yes Yes!!! Well, the problem is that I have little knowledge of lua. Could you help if you are not difficult?

Posted

Post what you have tried, so we can help you find your problem.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • 4 months later...
Posted

Guys once again explain. Need a script so when the player enters the car in the marker then it automatically change the settings on those machines that I asked.

Posted (edited)

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

Aftermath

Posted
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?

Posted

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.

Aftermath

Posted
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

Posted
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]

Posted
for me there's no error

what do you mean by token icon, you mean blip?

use createBlip function

the issue with the blip is already solved. Now when I pull up to the marker on the car then nothing happens

Posted
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) 

Posted
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  

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
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

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...