XetaQuake Posted June 13, 2008 Share Posted June 13, 2008 Hi all I have a little question, how can i change the blip icon color from the source - the player? I tried this, but not work: local r, g, b r, g, b = getTeamColor ( teamtest ) destroyBlipsAttachedTo ( source ) createBlipAttachedTo ( source, 0, 2, r, g, b ) I think thats a good idea to change the blip color, right? But i get this error and the color don´t changes: attempt to call global ´destroyBlipsAttachedTo´ I would be very happy when someone can help me, its required urgently Link to comment
robhol Posted June 13, 2008 Share Posted June 13, 2008 I'm no expert, but I don't think there is a function like that. At least it's not in the wiki. Link to comment
[DooD]Heavyair Posted June 13, 2008 Share Posted June 13, 2008 i think u are pretty close ( im no expert either mind ) there is a function. here it is http://development.mtasa.com/index.php?title=SetBlipColor but im unsure as to how to attach it to the blip of the player you want to change. i will have a play with it and see what happens will post any progress what do u want to change the blip color for ( player / checkpoint ) if its for a player you probably need getPlayerFromNick or getPlayerTeam which are here http://development.mtasa.com/index.php?title=GetPlayerFromNick http://development.mtasa.com/index.php?title=GetPlayerTeam Link to comment
XetaQuake Posted June 13, 2008 Author Share Posted June 13, 2008 Hi and thanks for help! I want to change the blip color for a player I also tried setBlipColor ( source, r, g, b, 255 ) - but nothing happens, and this time there a no errors, warnings etc. After that, it tried this: local r, g, b r, g, b = getTeamColor ( teamtest ) local targetPlayer = getPlayerFromNick ( source ) setBlipColor ( targetPlayer, r, g, b, 255 ) ... and get Bad Argument warnings: Bad argument @ 'getPlayerFromNick' Bad argument @ 'setBlipColor' Any ideas? Link to comment
[DooD]Heavyair Posted June 13, 2008 Share Posted June 13, 2008 this is almost there i think but i dont know ive only got me in my server so no one to check if color is changed im not sure if u need something that puts the blip attached to the player into a field or variable thingy here u go function blipchange ( player, command, name ) local theplayer = getPlayerFromNick ( name ) setBlipColor ( theplayer, 0, 0, 0, 0 ) outputChatBox ( "Blip color reset" ) end addCommandHandler ( "changeblip", blipchange ) i am very noob at scripting so no guarantees sorry Link to comment
XetaQuake Posted June 13, 2008 Author Share Posted June 13, 2008 I have absolutly the same function you posted PS: You can test it alone to, just press F11 and search you in the map Link to comment
Willy Posted June 14, 2008 Share Posted June 14, 2008 bool setBlipColor ( blip theBlip, int red, int green, int blue, int alpha ) local theplayer = getPlayerFromNick ( name ) setBlipColor ( theplayer, 0, 0, 0, 0 ), your example won't work because you've got "theplayer" which isn't a blip, its a player. You might want this: function getBlipAttachedTo( thePlayer ) local blips = getElementsByType( "blip" ) for k, theBlip in ipairs( blips ) do if getElementAttachedTo( theBlip ) == thePlayer then return theBlip end end return false end and then do: local theplayer = getPlayerFromNick ( name ) local theplayerblip = getBlipAttachedTo(theplayer) setBlipColor ( theplayerblip, 0, 0, 0, 0 ) the example on this page might be useful: http://development.mtasa.com/index.php?title=GetColorFromString Link to comment
XetaQuake Posted June 14, 2008 Author Share Posted June 14, 2008 I thank you so mutch! Works great now thread a finish 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