darhal Posted October 22, 2013 Posted October 22, 2013 for the resource custom blip how can I attatch a blip to a player ??
HoLsTeN Posted October 23, 2013 Posted October 23, 2013 search here https://wiki.multitheftauto.com/wiki/Res ... ustomblips
TAPL Posted October 23, 2013 Posted October 23, 2013 There no function to create attached blip, but you can change the position of the blip: You can get the position of the player: getElementPosition Then set the position of the blip to the position of the player: setCustomBlipPosition And in order for the blip to stay attached to the player continuously, you need to call this function with this event: onClientRender
darhal Posted October 23, 2013 Author Posted October 23, 2013 thank you TAPL but it s now it make a line of blips how I can destroy them or hide them ?
pa3ck Posted October 23, 2013 Posted October 23, 2013 Did you attach the blip to the player? If so, there should be only one blip for each player.
TAPL Posted October 23, 2013 Posted October 23, 2013 thank you TAPL but it s now it make a line of blips how I can destroy them or hide them ? DO NOT ever create blip, vehicle, marker, timer, and such thing with the event onClientRender.
darhal Posted October 23, 2013 Author Posted October 23, 2013 I understand you idea but can you give me example plz ? and ty
tosfera Posted October 26, 2013 Posted October 26, 2013 (edited) You can create a blip attached to a player, if you want to do that... addCommandHandler ( "placehit", function ( thePlayer, theCommand, hitPerson, hitPrice ) if ( ( hitPerson ) and ( hitPrice ) ) then if ( getPlayerFromName ( tostring ( hitPerson ) ) ) then local blip = createBlipAttachedTo ( getPlayerFromName ( tostring ( hitPerson ) ), 41 ); setElementData ( getPlayerFromName ( tostring ( hitPerson ) ), "hitprice", hitPrice ); outputChatBox ( tostring ( hitPerson ) .."'s is now worth $".. hitPrice ); else outputChatBox ( "This player is not online.", thePlayer ); end else outputChatBox ( "Wrong usage. example: /placehit billy 500", thePlayer ); end end ); Edited October 26, 2013 by Guest
tosfera Posted October 26, 2013 Posted October 26, 2013 You got a typo there, at line 9. Aww sh*t, haha. Thanks, fixed it. Not sure if it works anyway, should wait on darhal.
darhal Posted October 26, 2013 Author Posted October 26, 2013 I need custom blip exemple not this i dont know if you understand me
tosfera Posted October 26, 2013 Posted October 26, 2013 What do you mean with a custom blip? You want to create an image attached to a player on your radar? Just a random idea; create a static image as an element, attach that element over and over again with onClientRender?
WASSIm. Posted October 26, 2013 Posted October 26, 2013 this exmple make all players have custom blip local playerBlips = {} local image = "icon.png" addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function () for k, thePlayer in ipairs ( getElementsByType( "player" ) ) do if not ( playerBlips[thePlayer] ) then playerBlips[thePlayer] = exports.customblips:createCustomBlip ( 0, 0, 16, 16, image ) end end end ) addEventHandler( "onClientPlayerJoin", root, function() if not ( playerBlips[source] ) then playerBlips[source] = exports.customblips:createCustomBlip ( 0,0, 16, 16, image ) end end ) addEventHandler( "onClientRender", root, function () for thePlayer, theBlip in pairs( playerBlips ) do if ( isElement( thePlayer ) ) and not ( thePlayer == localPlayer ) then if ( theBlip ) then local x,y,z = getElementPosition( thePlayer ) exports.customblips:setCustomBlipPosition ( theBlip, x, y ) end end end end ) addEventHandler("onClientPlayerQuit",root, function () if ( isElement( playerBlips[source] ) ) then destroyElement( playerBlips[source] ) playerBlips[source] = nil end end )
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