Seba500PLK Posted August 12, 2014 Share Posted August 12, 2014 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
Et-win Posted August 12, 2014 Share Posted August 12, 2014 local account = getPlayerAccount (localPlayer) You can't give up 'localPlayer' because it's not client-side. Instead use: getElementsByType("player") And loop through them. Link to comment
Max+ Posted August 12, 2014 Share Posted August 12, 2014 --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
Et-win Posted August 12, 2014 Share Posted August 12, 2014 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
Max+ Posted August 12, 2014 Share Posted August 12, 2014 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
Et-win Posted August 12, 2014 Share Posted August 12, 2014 Only if you don't want to continue your script after creating the blip. Otherwise you could check or 'blip1' does exists. Link to comment
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 [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
Et-win Posted August 12, 2014 Share Posted August 12, 2014 +Max you are asleep (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+ Posted August 12, 2014 Share Posted August 12, 2014 +Max you are asleep (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
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 Now everyone can see Link to comment
Max+ Posted August 12, 2014 Share Posted August 12, 2014 try using this , setElementVisibleTo Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 blip createBlip ( float x, float y, float z [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 99999.0, [b][u]visibleTo = getRootElement( )[/u][/b] ] ) Link to comment
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 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
Et-win Posted August 12, 2014 Share Posted August 12, 2014 getPlayerFromName("Seba500PLK") To: nMax Or even better, make a table which puts all players into it who are Admin. Then create it with putting that table by 'visibleTo'. (Not really sure or it supports tables btw?) Link to comment
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 I have to be in groups, because he wants an automated system. Whoever buys this base gets Blip Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 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
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 [2014-08-12 14:06:03] WARNING: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:15: Bad argument @ 'createBlip' [Expected element at argument 12, got table] Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 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
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 THX!!! you are great!! Link to comment
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 ohhhh problem, as I come out of the server and will enter it disappears from the map Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 THX!!! you are great!! Don't forget that +Max helped you too. ohhhh problem, as I come out of the server and will enter it disappears from the map --[[Event:]] onPlayerLogin Link to comment
Seba500PLK Posted August 12, 2014 Author Share Posted August 12, 2014 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
Max+ Posted August 12, 2014 Share Posted August 12, 2014 ---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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now