Jump to content

Marker script


Nerses

Recommended Posts

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

that's what I do!!

show me debugscript

all right?

server

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", 4500.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 

meta

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

Link to comment
i said show me the debugscript not the code , type /debugscript 3 in your chatBox then press enter.

[2015-05-09 14:21:48] SCRIPT ERROR: [gameplay]/qwerty/server.lua:5: ')' expected near 'then'

[2015-05-09 14:21:48] ERROR: Loading script failed: [gameplay]/qwerty/server.lua:5: ')' expected near 'then'

Link to comment
i said show me the debugscript not the code , type /debugscript 3 in your chatBox then press enter.

[2015-05-09 14:21:48] SCRIPT ERROR: [gameplay]/qwerty/server.lua:5: ')' expected near 'then'

[2015-05-09 14:21:48] ERROR: Loading script failed: [gameplay]/qwerty/server.lua:5: ')' expected near 'then'

Done try this

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 
            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
i said show me the debugscript not the code , type /debugscript 3 in your chatBox then press enter.

[2015-05-09 14:21:48] SCRIPT ERROR: [gameplay]/qwerty/server.lua:5: ')' expected near 'then'

[2015-05-09 14:21:48] ERROR: Loading script failed: [gameplay]/qwerty/server.lua:5: ')' expected near 'then'

Done try this

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

[2015-05-09 14:31:15] WARNING: [gameplay]/qwerty/server.lua:3: Bad argument @ 'addEventHandler' [Expected element at argument 2, got boolean]

[2015-05-09 14:31:15] qwerty restarted successfully

Link to comment

[2015-05-09 14:31:15] WARNING: [gameplay]/qwerty/server.lua:3: Bad argument @ 'addEventHandler' [Expected element at argument 2, got boolean]

[2015-05-09 14:31:15] qwerty restarted successfully

did you add the local marker you can use this

  
local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
function markerHit(player,matchDim) 
         if (matchDim and isElement(player) and getElementType(player) == "player") then 
            if isPedInVehicle (player) then 
            local vehicle = getPedOccupiedVehicle(player) 
            VehicleHandling(player,vehicle) 
        end 
    end 
end 
addEventHandler("onMarkerHit", marker,markerHit) 

Link to comment

[2015-05-09 14:31:15] WARNING: [gameplay]/qwerty/server.lua:3: Bad argument @ 'addEventHandler' [Expected element at argument 2, got boolean]

[2015-05-09 14:31:15] qwerty restarted successfully

did you add the local marker you can use this

  
local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
function markerHit(player,matchDim) 
         if (matchDim and isElement(player) and getElementType(player) == "player") then 
            if isPedInVehicle (player) then 
            local vehicle = getPedOccupiedVehicle(player) 
            VehicleHandling(player,vehicle) 
        end 
    end 
end 
addEventHandler("onMarkerHit", marker,markerHit) 

again this error

[2015-05-09 14:54:11] WARNING: [gameplay]/qwerty/server.lua:12: Bad argument @ 'addEventHandler' [Expected element at argument 2, got boolean] 
[2015-05-09 14:54:11] qwerty restarted successfully 

Link to comment
post full code here.

server

  
local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) 
  
function markerHit(player,matchDim) 
         if (matchDim and isElement(player) and getElementType(player) == "player") then 
            if isPedInVehicle (player) then 
            local vehicle = getPedOccupiedVehicle(player) 
            VehicleHandling(player,vehicle) 
        end 
    end 
end 
addEventHandler("onMarkerHit", marker,markerHit) 
  
local blip = createBlip( -1187.7109375, -1308.9765625,0, 55, 0, 0, 0, 0, 0, 0, 250) 
setBlipVisibleDistance(blip, 1500) 
  
  
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 

meta

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

Link to comment
local x, y, z = 0, 0, 5 -- text position 
local text = "test" -- text  
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local x, y = getScreenFromWorldPosition ( x, y, z ); 
        dxDrawText ( text, x + 1, y + 1, x + 1, y + 1, tocolor ( 0, 0, 0, 255 ) ) 
        dxDrawText ( text, x, y, x, y, tocolor ( 255, 255, 255, 255 ) ) 
    end 
); 

Link to comment
local x, y, z = 0, 0, 5 -- text position 
local text = "test" -- text  
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local x, y = getScreenFromWorldPosition ( x, y, z ); 
        dxDrawText ( text, x + 1, y + 1, x + 1, y + 1, tocolor ( 0, 0, 0, 255 ) ) 
        dxDrawText ( text, x, y, x, y, tocolor ( 255, 255, 255, 255 ) ) 
    end 
); 

not working

Link to comment
All what you need is

-- function

guiGetScreenSize () 
getScreenFromWorldPosition() 
getCameraMatrix() 
getDistanceBetweenPoints3D() 
dxDrawText() 

-- Events

onClientPreRender() 

Sorry, I know little of the lua language. Just practicing more, so if you can then more paint, if not it's hard for you

Link to comment

This is how you can do it; i'm pretty sure that you have more than 1 marker so i decided to make it with a table.

local Text = { 
    -- text , position { x , y ,z } , color { r, g, b} 
    {text="put text here", tx = , ty = , tz = ,r = 255, g = 0, b = 0},   
} 
  
local screenX , screenY = guiGetScreenSize () 
  
function DrawText() 
    for a,b in pairs(Text) do 
        local x,y = getScreenFromWorldPosition(b["tx"], b["ty"], b["tz"]+0.2) 
        local camX,camY,camZ = getCameraMatrix() 
        if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xx, yy, zz) <= 20) then 
           dxDrawText ( b["text"] , x , y , x , y , tocolor (b["r"], b["g"], b["b"], 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) 
        end 
    end 
end 
addEventHandler("onClientPreRender", root, DrawText) 

Link to comment
This is how you can do it; i'm pretty sure that you have more than 1 marker so i decided to make it with a table.
local Text = { 
    -- text , position { x , y ,z } , color { r, g, b} 
    {text="put text here", tx = , ty = , tz = ,r = 255, g = 0, b = 0},   
} 
  
local screenX , screenY = guiGetScreenSize () 
  
function DrawText() 
    for a,b in pairs(Text) do 
        local x,y = getScreenFromWorldPosition(b["tx"], b["ty"], b["tz"]+0.2) 
        local camX,camY,camZ = getCameraMatrix() 
        if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xx, yy, zz) <= 20) then 
           dxDrawText ( b["text"] , x , y , x , y , tocolor (b["r"], b["g"], b["b"], 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) 
        end 
    end 
end 
addEventHandler("onClientPreRender", root, DrawText) 

not working

Link to comment
not working

next time try to post the debugscript + show me the code.

[2015-05-09 22:45:21] ERROR: [gameplay]/qwerty/server.lua:22: attempt to call global 'guiGetScreenSize' (a nil value)

[2015-05-09 22:45:21] qwerty restarted successfully

Link to comment
not working

next time try to post the debugscript + show me the code.

[2015-05-09 22:45:21] ERROR: [gameplay]/qwerty/server.lua:22: attempt to call global 'guiGetScreenSize' (a nil value)

[2015-05-09 22:45:21] qwerty restarted successfully

Man it's client side

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