Player Blips - StyledStrike/gmod-gminimap GitHub Wiki
GMinimap automatically handles blips for players. You can fine tune the blips (or if they should be visible at all) with the following functions.
GMinimap:SetOnlySameTeamBlips
GMinimap:SetOnlySameTeamBlips(sameTeamOnly: boolean)
Use this to set if the local player can only see players from the same team on the minimap.
Hook: CanSeePlayerBlip
This hook allows you to choose if the local player can see other player's blips, and the max. distance those blips are visible.
- This replaces the (now removed)
GMinimap:SetCanSeePlayerBlips
function - GMinimap will call this hook pretty frequently (Every 0.1 seconds, for all players)
- It passes a single
ply
parameter - You should return a
boolean
first (Can the local player seeply
's blip?) - You can also return a second
number
value to set the max. blip distance, otherwise the console variablegminimap_player_blips_max_distance
will be used.
Example
On a server with ULX Buildmode, let PvP players only see others that are nearby and on direct line of sight.
hook.Add( "CanSeePlayerBlip", "RestrictPlayerBlipsExample", function( ply )
local isInBuild = LocalPlayer():GetNWBool( "_Kyle_Buildmode" )
if isInBuild then return end
local canSee = LocalPlayer():IsLineOfSightClear( ply:EyePos() )
local maxDistance = 2000
return canSee, maxDistance
end )
Player:SetBlipIcon
Player:SetBlipIcon(icon?: string)
Set the icon path for a player's blip. Can be either a URL or a image file on the materials folder. Use nil
to restore the default icon.
Note: "Dead" and "in a vehicle" icons overrides this.
Example
for _, ply in ipairs( player.GetAll() ) do
if ply == LocalPlayer() then
-- make the local player use a tank icon
ply:SetBlipIcon( "gminimap/blips/tank.png" )
else
-- make other players use a cat icon from the web
ply:SetBlipIcon( "https://cdn3.emoji.gg/emojis/2319-astonished-cat.png" )
ply:SetBlipScale( 2 )
end
end
Player:SetBlipScale
Player:SetBlipScale(scale?: number)
Set the icon scale for a player's blip. Use nil
to restore to default.
Note: "Dead" and "in a vehicle" icons overrides this.
Player:SetBlipColor
Player:SetBlipColor(color?: Color)
Set the icon color for a player's blip. Use nil
to restore to default.
Note: "Dead" and "in a vehicle" icons overrides this.GMinimap automatically handles blips for players. You can fine tune the blips (or if they should be visible at all) with the following functions.