Jump to content

blip problem


Seba500PLK

Recommended Posts

Hi, does not display blip. Please help me

In Server-Side

function blips() 
  
    local account = getPlayerAccount (localPlayer) 
    
    if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup ( "Admin" ) )   then 
     blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999 ) 
  
    end 
 end 
  
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),blips) 

in Client-side clear

Link to comment

--Server

addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    local nAccount = getPlayerAccount(getAccountName ( nMax )) 
    if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
    blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999 ) 
      end 
   end 
end 
) 

i sure you Know how to destory the blip later .

Link to comment
addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    local nAccount = getPlayerAccount(getAccountName ( nMax )) 
    if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
    blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999 ) 
    return 
      end 
   end 
end 
) 

Otherwise you create serveral blips if there is more than 1 admin, since it's only creating the blip on 1 position.

Link to comment
addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    local nAccount = getPlayerAccount(getAccountName ( nMax )) 
    if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
    blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999 ) 
    return 
      end 
   end 
end 
) 

Otherwise you create serveral blips if there is more than 1 admin, since it's only creating the blip on 1 position.

Yeah , i didn't thought about that, your right so just add return will fix it ?

Link to comment

[2014-08-12 12:20:41] ERROR: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:5: attempt to concatenate local 'nAccount' (a boolean value)

[2014-08-12 12:20:41] WARNING: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got boolean]

[2014-08-12 12:20:41] WARNING: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:4: Bad argument @ 'getAccountName' [Expected account at argument 1, got player]

Link to comment

+Max you are asleep :D (No offense x3)

addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
     
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
        blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999 ) 
        return 
          end 
    end 
   end 
end 
) 

Link to comment
+Max you are asleep :D (No offense x3)
addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
     
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
        blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999 ) 
        return 
          end 
    end 
   end 
end 
) 

he he , i think You'r the awake one here lol

Link to comment

Now I see just me, how to make a group admins saw it?

addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        --if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
        blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999, getPlayerFromName("Seba500PLK") ) 
        --return 
          --end 
           
    end 
   end 
end 
) 

Link to comment
addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    local gPlayersInGroup = {} 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
            table.insert(gPlayersInGroup, nMax) 
          end 
          
    end 
   end 
    if (gPlayersInGroup[1] ~= nil) then 
        blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999, gPlayersInGroup ) 
    end 
end 
) 

I don't know or this works, just test it. All Admins should see it if 'visibleTo' supports tables.

Link to comment

Oki, so not supported.

addEventHandler("onResourceStart",resourceRoot, 
function ( ) 
    local gPlayersInGroup = {} 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999, nMax) 
          end 
          
    end 
   end 
end 
) 

This works, don't understand why I didn't do this in first place, lol.

Link to comment

ok all works thanks. thank you for your commitment

Final code:

  
--Server Side 
addEventHandler("onPlayerLogin",root, 
function ( ) 
    local gPlayersInGroup = {} 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999, nMax) 
          end 
          
    end 
   end 
end 
) 

Link to comment

---ServerSide ,

i add a code to delete the blip if the Player Quit so i doesn't cause lag on the server .

player_blips = {} 
  
addEventHandler("onPlayerLogin",root, 
function ( ) 
    for _, nMax in ipairs ( getElementsByType ( 'player' )) do 
    local nAccount = getAccountName(getPlayerAccount(nMax)) 
    if (nAccount) then 
        if isObjectInACLGroup ( "user." .. nAccount, aclGetGroup ( "Admin" ) ) then 
        blip1 = createBlip( 1586.1999511719, 1236.4000244141, 9.800000190735, 35, 2, 255, 0, 0, 255, 0, 99999, nMax) 
        player_blips[source] = blip1 
          end 
          
    end 
   end 
end 
) 
  
addEventHandler("onPlayerQuit", root, 
function ( ) 
  local blip1 = player_blips[source]  
  destroyElement(blip1) 
  player_blips[source] = nil 
  end 
) 
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...