Graphics::drawLine
Client-Side Function
JavaScript |
---|
JavaScript Syntax
Draws a line bewteen the 2 vectors, colors and alpha are between 0 and 255.
Must be called every frame.
Required Params
- x1: number
- y1: number
- z1: number
- x2: number
- y2: number
- z2: number
- red: number
- green: number
- blue: number
- alpha: number
Return value
- void
Syntax
mp.game.graphics.drawLine(x1, y1, z1, x2, y2, z2, red, green, blue, alpha)
Example
//draw a line from player's position to their forward looking position
mp.events.add('render', () => {
const {x, y, z} = mp.players.local.getForwardVector()
const {position} = mp.players.local;
mp.game.graphics.drawLine(position.x, position.y, position.z, x, y, z, 255, 255, 255, 255);
});
See also
- mp.game.graphics.setDebugLinesAndSpheresDrawingActive
- mp.game.graphics.drawDebugLine
- mp.game.graphics.drawDebugLineWithTwoColours
- mp.game.graphics.drawDebugSphere
- mp.game.graphics.drawDebugBox
- mp.game.graphics.drawDebugCross
- mp.game.graphics.drawDebugText
- mp.game.graphics.drawDebugText2D
- mp.game.graphics.drawLine
- mp.game.graphics.drawPoly
- mp.game.graphics.drawSpritePoly
- mp.game.graphics.drawSpritePoly2
- mp.game.graphics.drawBox
- mp.game.graphics.setBackfaceculling
- mp.game.graphics.beginTakeMissionCreatorPhoto
- mp.game.graphics.getStatusOfTakeMissionCreatorPhoto
- mp.game.graphics.freeMemoryForMissionCreatorPhoto
- mp.game.graphics.loadMissionCreatorPhoto
- mp.game.graphics.getStatusOfLoadMissionCreatorPhoto
- mp.game.graphics.beginTakeHighQualityPhoto
- mp.game.graphics.getStatusOfTakeHighQualityPhoto
- mp.game.graphics.freeMemoryForHighQualityPhoto
- mp.game.graphics.saveHighQualityPhoto
- mp.game.graphics.getStatusOfSaveHighQualityPhoto
- mp.game.graphics.freeMemoryForLowQualityPhoto
- mp.game.graphics.drawLowQualityPhotoToPhone
- mp.game.graphics.getMaximumNumberOfPhotos
- mp.game.graphics.getMaximumNumberOfCloudPhotos
- mp.game.graphics.getCurrentNumberOfCloudPhotos
- mp.game.graphics.getStatusOfSortedListOperation
- mp.game.graphics.returnTwo
- mp.game.graphics.drawLightWithRangeAndShadow
- mp.game.graphics.drawLightWithRange
- mp.game.graphics.drawSpotLight
- mp.game.graphics.drawSpotLightWithShadow
- mp.game.graphics.fadeUpPedLight
- mp.game.graphics.updateLightsOnEntity
- mp.game.graphics.drawMarker
- mp.game.graphics.drawMarker2
- mp.game.graphics.drawSphere
- mp.game.graphics.createCheckpoint
- mp.game.graphics.setCheckpointScale
- mp.game.graphics.setCheckpointIconScale
- mp.game.graphics.setCheckpointCylinderHeight
- mp.game.graphics.setCheckpointRgba
- mp.game.graphics.setCheckpointRgba2
- mp.game.graphics.deleteCheckpoint
- mp.game.graphics.dontRenderInGameUi
- mp.game.graphics.forceRenderInGameUi
- mp.game.graphics.requestStreamedTextureDict
- mp.game.graphics.hasStreamedTextureDictLoaded
- mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded
- mp.game.graphics.drawRect
- mp.game.graphics.setScriptGfxDrawBehindPausemenu
- mp.game.graphics.setScriptGfxDrawOrder
- mp.game.graphics.setScriptGfxAlign
- mp.game.graphics.setScreenDrawPosition
- mp.game.graphics.resetScriptGfxAlign
- mp.game.graphics.setScriptGfxAlignParams
- mp.game.graphics.getScriptGfxPosition
- mp.game.graphics.getSafeZoneSize
- mp.game.graphics.drawSprite
- mp.game.graphics.drawInteractiveSprite
- mp.game.graphics.drawSpriteUv
- mp.game.graphics.addEntityIcon
- mp.game.graphics.setEntityIconVisibility
- mp.game.graphics.setEntityIconColor
- mp.game.graphics.setDrawOrigin
- mp.game.graphics.clearDrawOrigin
- mp.game.graphics.setBinkMovie
- mp.game.graphics.playBinkMovie
- mp.game.graphics.stopBinkMovie
- mp.game.graphics.releaseBinkMovie
- mp.game.graphics.drawBinkMovie
- mp.game.graphics.setBinkMovieTime
- mp.game.graphics.getBinkMovieTime
- mp.game.graphics.setBinkMovieVolume
- mp.game.graphics.attachTvAudioToEntity
- mp.game.graphics.setBinkMovieUnk2
- mp.game.graphics.setTvAudioFrontend
- mp.game.graphics.setBinkShouldSkip
- mp.game.graphics.loadMovieMeshSet
- mp.game.graphics.releaseMovieMeshSet
- mp.game.graphics.queryMovieMeshSetState
- mp.game.graphics.getScreenResolution
- mp.game.graphics.getActiveScreenResolution
- mp.game.graphics.getScreenActiveResolution
- mp.game.graphics.getAspectRatio
- mp.game.graphics.getScreenAspectRatio
- mp.game.graphics.getIsWidescreen
- mp.game.graphics.getIsHidef
- mp.game.graphics.setNightvision
- mp.game.graphics.getRequestingnightvision
- mp.game.graphics.getUsingnightvision
- mp.game.graphics.setNoiseoveride
- mp.game.graphics.setNoisinessoveride
- mp.game.graphics.getScreenCoordFromWorldCoord
- mp.game.graphics.getTextureResolution
- mp.game.graphics.overridePedBadgeTexture
- mp.game.graphics.setFlash
- mp.game.graphics.disableOcclusionThisFrame
- mp.game.graphics.setArtificialLightsState
- mp.game.graphics.setBlackout
- mp.game.graphics.setArtificialLightsStateAffectsVehicles
- mp.game.graphics.createTrackedPoint
- mp.game.graphics.setTrackedPointInfo
- mp.game.graphics.isTrackedPointVisible
- mp.game.graphics.destroyTrackedPoint
- mp.game.graphics.grassLodShrinkScriptAreas
- mp.game.graphics.grassLodResetScriptAreas
- mp.game.graphics.cascadeShadowsInitSession
- mp.game.graphics.cascadeShadowsSetCascadeBounds
- mp.game.graphics.cascadeShadowsSetCascadeBoundsScale
- mp.game.graphics.cascadeShadowsSetEntityTrackerScale
- mp.game.graphics.cascadeShadowsEnableEntityTracker
- mp.game.graphics.setFarShadowsSuppressed
- mp.game.graphics.cascadeShadowsSetShadowSampleType
- mp.game.graphics.cascadeShadowsClearShadowSampleType
- mp.game.graphics.cascadeShadowsSetAircraftMode
- mp.game.graphics.cascadeShadowsSetDynamicDepthMode
- mp.game.graphics.cascadeShadowsSetDynamicDepthValue
- mp.game.graphics.golfTrailSetEnabled
- mp.game.graphics.golfTrailSetPath
- mp.game.graphics.golfTrailSetRadius
- mp.game.graphics.golfTrailSetColour
- mp.game.graphics.golfTrailSetTessellation
- mp.game.graphics.golfTrailSetFixedControlPoint
- mp.game.graphics.golfTrailSetShaderParams
- mp.game.graphics.golfTrailSetFacing
- mp.game.graphics.golfTrailGetMaxHeight
- mp.game.graphics.golfTrailGetVisualControlPoint
- mp.game.graphics.setSeethrough
- mp.game.graphics.getUsingseethrough
- mp.game.graphics.seethroughReset
- mp.game.graphics.seethroughSetFadeStartDistance
- mp.game.graphics.seethroughSetFadeEndDistance
- mp.game.graphics.seethroughGetMaxThickness
- mp.game.graphics.seethroughSetMaxThickness
- mp.game.graphics.seethroughSetNoiseAmountMin
- mp.game.graphics.seethroughSetNoiseAmountMax
- mp.game.graphics.seethroughSetHiLightIntensity
- mp.game.graphics.seethroughSetHiLightNoise
- mp.game.graphics.seethroughSetHeatscale
- mp.game.graphics.seethroughSetColorNear
- mp.game.graphics.togglePlayerDamageOverlay
- mp.game.graphics.triggerScreenblurFadeIn
- mp.game.graphics.transitionToBlurred
- mp.game.graphics.triggerScreenblurFadeOut
- mp.game.graphics.transitionFromBlurred
- mp.game.graphics.disableScreenblurFade
- mp.game.graphics.getScreenblurFadeCurrentTime
- mp.game.graphics.isScreenblurFadeRunning
- mp.game.graphics.togglePausedRenderphases
- mp.game.graphics.setFrozenRenderingDisabled
- mp.game.graphics.getTogglePausedRenderphasesStatus
- mp.game.graphics.resetPausedRenderphases
- mp.game.graphics.setHidofEnvBlurParams
- mp.game.graphics.startParticleFxNonLoopedAtCoord
- mp.game.graphics.startNetworkedParticleFxNonLoopedAtCoord
- mp.game.graphics.startParticleFxNonLoopedAtCoord2
- mp.game.graphics.startParticleFxNonLoopedOnPedBone
- mp.game.graphics.startNetworkedParticleFxNonLoopedOnPedBone
- mp.game.graphics.startParticleFxNonLoopedOnPedBone2
- mp.game.graphics.startParticleFxNonLoopedOnEntity
- mp.game.graphics.startNetworkedParticleFxNonLoopedOnEntity
- mp.game.graphics.startParticleFxNonLoopedOnEntity2
- mp.game.graphics.startNetworkedParticleFxNonLoopedOnEntityBone
- mp.game.graphics.setParticleFxNonLoopedColour
- mp.game.graphics.setParticleFxNonLoopedAlpha
- mp.game.graphics.startParticleFxLoopedAtCoord
- mp.game.graphics.startParticleFxLoopedOnPedBone
- mp.game.graphics.startParticleFxLoopedOnEntity
- mp.game.graphics.startParticleFxLoopedOnEntityBone
- mp.game.graphics.startNetworkedParticleFxLoopedOnEntity
- mp.game.graphics.startParticleFxLoopedOnEntity2
- mp.game.graphics.startNetworkedParticleFxLoopedOnEntityBone
- mp.game.graphics.startParticleFxLoopedOnEntityBone2
- mp.game.graphics.stopParticleFxLooped
- mp.game.graphics.removeParticleFx
- mp.game.graphics.removeParticleFxFromEntity
- mp.game.graphics.removeParticleFxInRange
- mp.game.graphics.doesParticleFxLoopedExist
- mp.game.graphics.setParticleFxLoopedOffsets
- mp.game.graphics.setParticleFxLoopedEvolution
- mp.game.graphics.setParticleFxLoopedColour
- mp.game.graphics.setParticleFxLoopedAlpha
- mp.game.graphics.setParticleFxLoopedScale
- mp.game.graphics.setParticleFxLoopedFarClipDist
- mp.game.graphics.setParticleFxLoopedRange
- mp.game.graphics.setParticleFxCamInsideVehicle
- mp.game.graphics.setParticleFxCamInsideNonplayerVehicle
- mp.game.graphics.setParticleFxShootoutBoat
- mp.game.graphics.enableClownBloodVfx
- mp.game.graphics.enableAlienBloodVfx
- mp.game.graphics.setParticleFxBulletImpactScale
- mp.game.graphics.useParticleFxAsset
- mp.game.graphics.setPtfxAssetNextCall
- mp.game.graphics.setParticleFxOverride
- mp.game.graphics.setPtfxAssetOldToNew
- mp.game.graphics.resetParticleFxOverride
- mp.game.graphics.washDecalsInRange
- mp.game.graphics.washDecalsFromVehicle
- mp.game.graphics.fadeDecalsInRange
- mp.game.graphics.removeDecalsInRange
- mp.game.graphics.removeDecalsFromObject
- mp.game.graphics.removeDecalsFromObjectFacing
- mp.game.graphics.removeDecalsFromVehicle
- mp.game.graphics.addDecal
- mp.game.graphics.addPetrolDecal
- mp.game.graphics.startPetrolTrailDecals
- mp.game.graphics.addPetrolTrailDecalInfo
- mp.game.graphics.endPetrolTrailDecals
- mp.game.graphics.removeDecal
- mp.game.graphics.isDecalAlive
- mp.game.graphics.getDecalWashLevel
- mp.game.graphics.setDisableDecalRenderingThisFrame
- mp.game.graphics.getIsPetrolDecalInRange
- mp.game.graphics.patchDecalDiffuseMap
- mp.game.graphics.unpatchDecalDiffuseMap
- mp.game.graphics.moveVehicleDecals
- mp.game.graphics.addVehicleCrewEmblem
- mp.game.graphics.removeVehicleCrewEmblem
- mp.game.graphics.getVehicleCrewEmblemRequestState
- mp.game.graphics.doesVehicleHaveCrewEmblem
- mp.game.graphics.overrideInteriorSmokeName
- mp.game.graphics.overrideInteriorSmokeLevel
- mp.game.graphics.overrideInteriorSmokeEnd
- mp.game.graphics.registerNoirScreenEffectThisFrame
- mp.game.graphics.disableVehicleDistantlights
- mp.game.graphics.setForcePedFootstepsTracks
- mp.game.graphics.setForceVehicleTrails
- mp.game.graphics.disableScriptAmbientEffects
- mp.game.graphics.presetInteriorAmbientCache
- mp.game.graphics.setTimecycleModifier
- mp.game.graphics.setTimecycleModifierStrength
- mp.game.graphics.setTransitionTimecycleModifier
- mp.game.graphics.clearTimecycleModifier
- mp.game.graphics.getTimecycleModifierIndex
- mp.game.graphics.getTimecycleTransitionModifierIndex
- mp.game.graphics.pushTimecycleModifier
- mp.game.graphics.popTimecycleModifier
- mp.game.graphics.setCurrentPlayerTcmodifier
- mp.game.graphics.setPlayerTcmodifierTransition
- mp.game.graphics.setNextPlayerTcmodifier
- mp.game.graphics.addTcmodifierOverride
- mp.game.graphics.removeTcmodifierOverride
- mp.game.graphics.setExtraTimecycleModifier
- mp.game.graphics.clearExtraTimecycleModifier
- mp.game.graphics.getExtraTimecycleModifierIndex
- mp.game.graphics.setExtraTimecycleModifierStrength
- mp.game.graphics.resetExtraTimecycleModifierStrength
- mp.game.graphics.requestScaleformMovie
- mp.game.graphics.requestScaleformMovie2
- mp.game.graphics.requestScaleformMovieInstance
- mp.game.graphics.requestScaleformMovieInteractive
- mp.game.graphics.requestScaleformMovie3
- mp.game.graphics.hasScaleformMovieLoaded
- mp.game.graphics.hasScaleformMovieFilenameLoaded
- mp.game.graphics.hasNamedScaleformMovieLoaded
- mp.game.graphics.hasScaleformContainerMovieLoadedIntoParent
- mp.game.graphics.setScaleformMovieAsNoLongerNeeded
- mp.game.graphics.setScaleformMovieToUseSystemTime
- mp.game.graphics.setScaleformFitRendertarget
- mp.game.graphics.drawScaleformMovie
- mp.game.graphics.drawScaleformMovieFullscreen
- mp.game.graphics.drawScaleformMovieFullscreenMasked
- mp.game.graphics.drawScaleformMovie3D
- mp.game.graphics.drawScaleformMovie3DSolid
- mp.game.graphics.callScaleformMovieMethod
- mp.game.graphics.callScaleformMovieMethodWithNumber
- mp.game.graphics.callScaleformMovieFunctionFloatParams
- mp.game.graphics.callScaleformMovieMethodWithString
- mp.game.graphics.callScaleformMovieFunctionStringParams
- mp.game.graphics.callScaleformMovieMethodWithNumberAndString
- mp.game.graphics.callScaleformMovieFunctionMixedParams
- mp.game.graphics.beginScaleformScriptHudMovieMethod
- mp.game.graphics.pushScaleformMovieFunctionFromHudComponent
- mp.game.graphics.beginScaleformMovieMethod
- mp.game.graphics.pushScaleformMovieFunction
- mp.game.graphics.beginScaleformMovieMethodOnFrontend
- mp.game.graphics.pushScaleformMovieFunctionN
- mp.game.graphics.beginScaleformMovieMethodOnFrontendHeader
- mp.game.graphics.endScaleformMovieMethod
- mp.game.graphics.popScaleformMovieFunctionVoid
- mp.game.graphics.endScaleformMovieMethodReturnValue
- mp.game.graphics.popScaleformMovieFunction
- mp.game.graphics.isScaleformMovieMethodReturnValueReady
- mp.game.graphics.getScaleformMovieMethodReturnValueInt
- mp.game.graphics.getScaleformMovieMethodReturnValueBool
- mp.game.graphics.getScaleformMovieMethodReturnValueString
- mp.game.graphics.sittingTv
- mp.game.graphics.scaleformMovieMethodAddParamInt
- mp.game.graphics.pushScaleformMovieFunctionParameterInt
- mp.game.graphics.scaleformMovieMethodAddParamFloat
- mp.game.graphics.pushScaleformMovieFunctionParameterFloat
- mp.game.graphics.scaleformMovieMethodAddParamBool
- mp.game.graphics.pushScaleformMovieFunctionParameterBool
- mp.game.graphics.beginTextCommandScaleformString
- mp.game.graphics.beginTextComponent
- mp.game.graphics.endTextCommandScaleformString
- mp.game.graphics.endTextComponent
- mp.game.graphics.endTextCommandScaleformString2
- mp.game.graphics.scaleformMovieMethodAddParamTextureNameString2
- mp.game.graphics.scaleformMovieMethodAddParamTextureNameString
- mp.game.graphics.pushScaleformMovieFunctionParameterString
- mp.game.graphics.scaleformMovieMethodAddParamPlayerNameString
- mp.game.graphics.doesLatestBriefStringExist
- mp.game.graphics.scaleformMovieMethodAddParamLatestBriefString
- mp.game.graphics.requestScaleformScriptHudMovie
- mp.game.graphics.requestHudScaleform
- mp.game.graphics.hasScaleformScriptHudMovieLoaded
- mp.game.graphics.hasHudScaleformLoaded
- mp.game.graphics.removeScaleformScriptHudMovie
- mp.game.graphics.setTvChannel
- mp.game.graphics.getTvChannel
- mp.game.graphics.setTvVolume
- mp.game.graphics.getTvVolume
- mp.game.graphics.drawTvChannel
- mp.game.graphics.setTvChannelPlaylist
- mp.game.graphics.setTvChannelPlaylistAtHour
- mp.game.graphics.clearTvChannelPlaylist
- mp.game.graphics.isPlaylistUnk
- mp.game.graphics.isTvPlaylistItemPlaying
- mp.game.graphics.loadTvChannel
- mp.game.graphics.enableMovieKeyframeWait
- mp.game.graphics.enableMovieSubtitles
- mp.game.graphics.ui3DsceneIsAvailable
- mp.game.graphics.ui3DscenePushPreset
- mp.game.graphics.terraingridActivate
- mp.game.graphics.terraingridSetParams
- mp.game.graphics.terraingridSetColours
- mp.game.graphics.animpostfxPlay
- mp.game.graphics.startScreenEffect
- mp.game.graphics.animpostfxStop
- mp.game.graphics.stopScreenEffect
- mp.game.graphics.animpostfxGetUnk
- mp.game.graphics.animpostfxIsRunning
- mp.game.graphics.getScreenEffectIsActive
- mp.game.graphics.animpostfxStopAll
- mp.game.graphics.stopAllScreenEffects
- mp.game.graphics.animpostfxStopAndDoUnk
- mp.game.graphics.setLightsState
- mp.game.graphics.resetLightsState
- mp.game.graphics.getLightsState
- mp.game.graphics.createWorldTextureSwap
- mp.game.graphics.removeWorldTextureSwap
- mp.game.graphics.resetWorldTextureSwaps
- mp.game.graphics.registerTextFontId
- mp.game.graphics.pushTextureOverride
- mp.game.graphics.popTextureOverride
- mp.game.graphics.screen2dToWorld3d
- mp.game.graphics.world3dToScreen2d
- mp.game.graphics.notify
- mp.game.graphics.drawScaleformMovie3dNonAdditive
- mp.game.graphics.setParticleFxBloodScale
- mp.game.graphics.set2dLayer
- mp.game.graphics.drawScaleformMovie3d
- mp.game.graphics.drawDebugText2d
- mp.game.graphics.drawText
- mp.game.graphics.createEntityOverlayBatch
- mp.game.graphics.setEntityOverlayPassEnabled