knightscript Posted January 18, 2016 Share Posted January 18, 2016 Hello, i´m using al3grab group system, (https://forum.multitheftauto.com/viewtopic.php?f=108&t=57237), and i saw on a DayZ server that you can mark on gps and map where your teammate is, i dont know what functions to use, and i would like to do it, i do not want someone to make it for me, i want to learn how to do it. Thanks Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 Or, if there is a better option (clan system with gps marker), i am open for suggestions. Thanks Link to comment
ViRuZGamiing Posted January 18, 2016 Share Posted January 18, 2016 createBlipAttachedTo If you set the visibleDistance high enough, you see the blip from every position on your 'gps', it's always visible on Radar (F11) tho. Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 Hello, i just tryed to do it and it doesnt show no error, this is what I tried: function gps(player) local group = getElementData(player,"Group") local name = getPlayerName(player) if group == "N/A" then return end for k,v in ipairs ( getElementsByType("player") ) do local g = getElementData(v,"Group") if g == group then local myBlip = createBlipAttachedTo ( name, 52 ) end end end and of course the event handler addEventHandler ("OnResourceStart", root,gps) the problem is, it doesnt show anything on the map. Thanks Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 I just found this code: root = getRootElement () color = { 0, 255, 0 } players = {} resourceRoot = getResourceRootElement ( getThisResource () ) function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end function onPlayerSpawn ( spawnpoint ) if ( players[source] ) then createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) end end function onPlayerQuit () destroyBlipsAttachedTo ( source ) end function onPlayerWasted ( totalammo, killer, killerweapon ) destroyBlipsAttachedTo ( source ) end function setBlipsColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then color = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } for id, player in ipairs( getElementsByType ( "player" ) ) do destroyBlipsAttachedTo ( player ) if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end end function setBlipColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then destroyBlipsAttachedTo ( source ) players[source] = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) end end addCommandHandler ( "setblipscolor", setBlipsColor ) addCommandHandler ( "setblipcolor", setBlipColor ) addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) 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 It creates the blip for all players online, but i dont know how to edit it to show only teammates, maybe there is another group system out there? Link to comment
ViRuZGamiing Posted January 18, 2016 Share Posted January 18, 2016 The best to do is just create your own group system of course if you do like the one you're using you could adapt your code to fit in with the group panel. Link to comment
knightscript Posted January 19, 2016 Author Share Posted January 19, 2016 Alright ViRuZGamiing, but, is there any other gang/group resource that has an integrated GPS system?. Thank you. 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