ViRuZGamiing Posted January 1, 2014 Posted January 1, 2014 Hello, I'm using Customblips and Playerblips but I want to change the player's blip to a customblip. Playerblips: 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 Customblip exports.customblips:createCustomBlip ( x, y,32, "images/player.png", 50 ) How can I get it in? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Moderators IIYAMA Posted January 1, 2014 Moderators Posted January 1, 2014 As far as I know. local blip = exports.customblips:createCustomBlip ( x, y,32, "images/player.png", 50 ) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ViRuZGamiing Posted January 1, 2014 Author Posted January 1, 2014 This is from the basic script: createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) Does that become this: local blip = exports.customblips:createCustomBlip ( x, y,32, "images/player.png", 50 ) attachElements ( blip, players[source][1], players[source][2], players[source][3] ) and what with the x,y of the createcustomblip? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
TAPL Posted January 1, 2014 Posted January 1, 2014 https://forum.multitheftauto.com/viewtopic.php?f=91&t=66593
ViRuZGamiing Posted January 1, 2014 Author Posted January 1, 2014 Thx and also thx to Wassim. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
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