Kellus
;-)
Wiek: 28 Na forum: 3249 dni Posty: 17
Nick w MP: Kellus
Piwa : 810
"Mezo." napisał/a :Co masz na mysli, podpiac blipy innego koloru, chcesz zmienic kolor blip?w przyk?adowo markeru? pode?lij skrypt w [lua] z clienta badz tam gdzie znajduje sie funkcja tworzenia markera to Ci to zmienie i powiedz na jaki kolor.
Chce ?eby tak by?o ?e normalnie sapd?w nie wida? - jest to zrobione w skrypcie ale ?eby podpi?? elementdate tylko ?eby SAPDy mi?dzy sob? widzia?y niebieskie blipy a gracze ich nie widzieli na mapie czyli "nil"
Kod: local BLIP_R, BLIP_G, BLIP_B = 255, 255, 255
local BLIP_FACTION = {
["SAPD"] = nil,
["SAMC"] = {255,0,255},
["SAFD"] = {0, 255, 255},
["TSA"] = {255,230,0},
["SARA"] = {255,120,0},
}
local function destroyBlipsAttachedTo( player )
local attached = getAttachedElements ( player )
if ( attached ) then
for k,element in ipairs(attached) do
if getElementType ( element ) == "blip" then
destroyElement ( element )
end
end
end
end
local function isBlipsAttachedTo(elemente)
local attached = getAttachedElements ( elemente )
if ( attached ) then
for k,element in ipairs(attached) do
if getElementType ( element ) == "blip" then
return true
end
end
end
return false
end
local function destroyPlayerBlip( plr )
destroyBlipsAttachedTo ( plr )
end
local function createPlayerBlip( plr, red, green, blue )
if type(red) ~= "number" then
red = BLIP_R
end
if type(green) ~= "number" then
green = BLIP_G
end
if type(blue) ~= "number" then
blue = BLIP_B
end
destroyBlipsAttachedTo ( plr )
createBlipAttachedTo ( plr, 0, 2, red, green, blue, 255, 0, 255 )
end
local function createFactionBlip( plr, table )
destroyBlipsAttachedTo ( plr )
if type(table) ~= "nil" then
local r,g,b = unpack(table)
createBlipAttachedTo ( plr, 0, 2, r, g, b, 255, 0, 255 )
end
end
local function createEveryoneBlip()
for id, player in ipairs( getElementsByType ( "player" ) ) do
local faction = getElementData( player, "player:faction" )
local deathmatch = getElementData( player, "player:strefaDM" )
if faction and faction ~= false then
-- create faction blip
createFactionBlip( player, BLIP_FACTION[faction] )
elseif deathmatch and deathmatch ~= false then
-- create deathmatch blip
createFactionBlip( player, nil)
else
-- create player blip
createPlayerBlip(player, BLIP_R, BLIP_G, BLIP_B)
end
end
end
local function chcekVehiclesBlips()
UID = getElementData( localPlayer, "player:uid" )
ORG = getElementData( localPlayer, "player:organization" )
if not UID then return end
Async:foreach(getElementsByType( "vehicle", getResourceRootElement(getResourceFromName( "dmta_vehicles")) ), function(vehicle)
if isBlipsAttachedTo(vehicle) == false then
if getElementData( vehicle, "vehicle:ownedPlayer" ) == UID then
createBlipAttachedTo( vehicle, 0,1,255,0,0,255,1,9999 )
return
elseif ORG and getElementData( vehicle, "vehicle:ownedGroup" ) == ORG then
createBlipAttachedTo( vehicle, 0,1,0,255,0,255,1,9999 )
return
else
local rent = getElementData( vehicle, "vehicle:rent" )
if rent and (type(rent) == "table") and #rent > 0 then
for i,s in pairs(rent) do
if tonumber(s) == UID then
createBlipAttachedTo( vehicle, 0,1,0,0,255,255,1,9999 )
return
end
end
end
end
end
end);
end
addEventHandler ( "onClientResourceStart", resourceRoot, createEveryoneBlip )
addEventHandler ( "onClientPlayerSpawn", root, function()
-- create player blip
createPlayerBlip(source)
end)
addEventHandler ( "onClientPlayerQuit", root, function()
-- destroy player blip
destroyPlayerBlip(source)
end)
addEventHandler ( "onClientPlayerWasted", root, function()
-- destroy player blip
destroyPlayerBlip(source)
end)
addEventHandler( "onClientElementDestroy", root, function()
-- check blip is attached
if isBlipsAttachedTo(source) then
-- destroy blip
destroyBlipsAttachedTo(source)
end
end)
addEventHandler( "onClientElementDataChange", root, function(key, old, new)
-- element type
local elementType = getElementType( source )
if elementType == "player" then
-- check element data key
if key == "player:faction" then
-- check new key
if new and new ~= false then
createFactionBlip( source, BLIP_FACTION[new] )
else
createPlayerBlip( source )
end
elseif key == "player:strefaDM" then
if new and new ~= false then
createFactionBlip( source, nil )
else
createPlayerBlip( source )
end
end
elseif elementType == "vehicle" then
-- check element data key
if key == "vehicle:ownedPlayer" or key == "vehicle:rent" then
-- check is attached blip
if isBlipsAttachedTo( source ) then
-- destroy blip
destroyBlipsAttachedTo( source )
end
end
end
end)
chcekVehiclesBlips()
setTimer( chcekVehiclesBlips, 60000, 0 )
bindKey('F3', 'down', function()
if not getElementData(localPlayer, 'player:spawn') then
return
end
panelVisible = not panelVisible
if panelVisible then
showCursor(true)
else
showCursor(false)
end
end)
[ Dodano : 2023-07-01, 01:15 ]
"Ciastuu?" napisał/a : "Kellus" napisał/a :wie kto? mo?e jak podpi?? innego koloru blipy pod sapdy na mapce w skrypcie
Jakiego skryptu u?ywasz do pokazywania blip?w?
Z paczki westside w corze plik lua - "s_playerblips" kod wy?ej ^^