Ma5ter Posted June 29, 2014 Share Posted June 29, 2014 Was trying to make a script that hides my blip but it doesnt hide my blip, nor did it output any chat in the chatbox. root = getRootElement () players = { } resourceRoot = getResourceRootElement ( getThisResource () ) addCommandHandler ( hideme, function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then destroyBlipsAttachedTo ( source ) outputChatBox ( "You are hidden.", source, 255, 255, 255, true ) end end end true, true) 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 Link to comment
Memory Posted June 29, 2014 Share Posted June 29, 2014 Where found you this code? addCommandHandler ( hideme, function ( ) for id, player in ipairs( getElementsByType ( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then destroyBlipsAttachedTo ( player ) outputChatBox ( "You are hidden.", player, 255, 255, 255, true ) end end end) 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 or only for you: addCommandHandler ( hideme, function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then destroyBlipsAttachedTo ( thePlayer ) outputChatBox ( "You are hidden.", thePlayer, 255, 255, 255, true ) end end) 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 Link to comment
Ma5ter Posted June 30, 2014 Author Share Posted June 30, 2014 Code didnt work, here's the warning, also yeah I got the code from the playerblips resource since i'm still new to this. WARNING: [gameplay]\bliphider\playerblips.lua:2: Bad arguement @ "addCommandHandler" [Expected String at argument 1, got nil] Link to comment
Max+ Posted June 30, 2014 Share Posted June 30, 2014 it should be string , addCommandHandler( 'hide' , Link to comment
_DrXenon Posted June 30, 2014 Share Posted June 30, 2014 The first parameter of addCommandHandler is thePlayer who typed it. So resource para is the player. ( parameters name doesnt matter) Link to comment
Ma5ter Posted July 3, 2014 Author Share Posted July 3, 2014 The script isnt hiding my blip, I did change the parameter to a string and players can still see my blip. Link to comment
Grafu Posted July 3, 2014 Share Posted July 3, 2014 addCommandHandler("hidemyblip", function(player) local account = getPlayerAccount(player) if not isGuestAccount(account) and isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Admin")) then for index, element in ipairs(getAttachedElements(player)) do if getElementType(element) == "blip" then destroyElement(element) end end outputChatBox("You are now invisible on the radar", player) end end) Link to comment
Ma5ter Posted July 3, 2014 Author Share Posted July 3, 2014 The script still isnt hiding my blip. Link to comment
Grafu Posted July 3, 2014 Share Posted July 3, 2014 The script still isnt hiding my blip. Cover the blip with your finger then and you won't see it. >.> Here is an useful link for you, might help: https://wiki.multitheftauto.com/wiki/Sc ... troduction Link to comment
Max+ Posted July 3, 2014 Share Posted July 3, 2014 Try This , addCommandHandler ( "blip", function ( thePlayer ) for index, element in ipairs ( getAttachedElements ( thePlayer ) ) do if ( getElementType ( element ) == "blip" ) then destroyElement ( element ) end end end ) 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