Moderators IIYAMA Posted April 6, 2013 Moderators Share Posted April 6, 2013 blip createBlipAttachedTo ( element elementToAttachTo, [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, visibleTo = getRootElement()] ) The last argument is about the visibility from the blip, I can fill in 1 element or the root. Is it possible to fill in more elements(players)? https://wiki.multitheftauto.com/wiki/Cr ... AttachedTo support tables? Link to comment
NodZen Posted April 6, 2013 Share Posted April 6, 2013 i think so, but i not sure. And tables? Why not? Link to comment
Moderators IIYAMA Posted April 6, 2013 Author Moderators Share Posted April 6, 2013 Because nobody says anything about tables? Link to comment
NodZen Posted April 6, 2013 Share Posted April 6, 2013 Because nobody says anything about tables? The only way to know is to try it. Link to comment
Moderators IIYAMA Posted April 6, 2013 Author Moderators Share Posted April 6, 2013 or to wait for somebody who knows already the answer, it does not have my priority that's why I post it on the forum. I am 100% sure somebody already tried it. Link to comment
ixjf Posted April 6, 2013 Share Posted April 6, 2013 (edited) You can make wrappers of blip functions, here's an example of how would createBlipAttachedTo seem like: _createBlipAttachedTo = createBlipAttachedTo function createBlipAttachedTo ( ... ) if ( type ( arg [ #arg ] ) ~= 'table' ) then return _createBlipAttachedTo ( ... ) end local pElement = createElement ( "blip" ) local blipArray = {} for i,v in ipairs ( arg [ #arg ] ) do local newArg = arg newArg [ #newArg ] = nil blipArray [ #blipArray + 1 ] = createBlipAttachedTo ( unpack ( newArg ), v ) end setElementData ( pElement, "blips", blipArray ) return pElement end The con is that you have to modify other functions that has a blip element as parameter. Edited April 11, 2013 by Guest Link to comment
Moderators IIYAMA Posted April 6, 2013 Author Moderators Share Posted April 6, 2013 Some of the arguments I don't understand. Like: ... arg -- doesn't this have to be defined?(probably it is already defined with ... but I don't understand that) Right now I am making for every player a blip and create 1 element that contains all elements? Isn't it better to use setElementVisibleTo to reduce the amount of elements? Link to comment
ixjf Posted April 6, 2013 Share Posted April 6, 2013 Some of the arguments I don't understand.Like: ... arg -- doesn't this have to be defined?(probably it is already defined with ... but I don't understand that) arg is a Lua pre-defined variable, it has the same meaning of '...' which is a table of variables. Right now I am making for every player a blip and create 1 element that contains all elements?Isn't it better to use setElementVisibleTo to reduce the amount of elements? Indeed, I didn't think about the most efficient way to do it, I firstly had that idea and this code is supposed to give you an idea of how you could do it. Link to comment
Moderators IIYAMA Posted April 6, 2013 Author Moderators Share Posted April 6, 2013 Thank you for explaining me things I did not used before and how to make a wrapper. I think I will use setElementVisibleTo to manage the visibility. 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