sckatchof Posted March 13, 2012 Share Posted March 13, 2012 i have make a panel when i select a player i pin him i the radar and i have make ather button to remove to mark but i dont work there is my script : server side : function removePin(thePlayer,playername) local player = getPlayerFromName(playername) if (player) then setTimer(destroyElement,500,1,blip) else outputChatBox("Player not found",thePlayer,255,0,0) end end addEvent("unmark", true) addEventHandler("unmark", getRootElement(), removePin) Link to comment
bandi94 Posted March 13, 2012 Share Posted March 13, 2012 where is the "blip" element added ? function removePin(thePlayer,playername) local player = getPlayerFromName(playername) if (player) then for i,v in pairs">pairs(getAttachedElements(player)) do if getElementType(v)=="blip" then destroyElement(v) end end else outputChatBox("Player not found",thePlayer,255,0,0) end end addEvent("unmark", true) addEventHandler("unmark", getRootElement(), removePin) Link to comment
sckatchof Posted March 13, 2012 Author Share Posted March 13, 2012 thank but i have ERRO this is the blip when i select a pllayer it work function Pin(thePlayer,playername) local player = getPlayerFromName(playername) if (player) then local blip = createBlipAttachedTo (player, 41, 4, 255, 0, 0, 255, 0, 99999.0, thePlayer) else outputChatBox("Player not found",thePlayer,255,0,0) end end addEvent("pin", true) addEventHandler("pin", getRootElement(), Pin) but i have make ather button for removemark it still dont work. function removePin(thePlayer,playername) local player = getPlayerFromName(playername) if (player) then for i,v in pairs">pairs">pairs">pairs">pairs(getAttachedElements(player)) do if getElementType(v)=="blip" then destroyElement(v) end end else outputChatBox("Player not found",thePlayer,255,0,0) end end addEvent("unmark", true) addEventHandler("unmark", getRootElement(), removePin) Link to comment
Sparrow Posted March 13, 2012 Share Posted March 13, 2012 try this: function removePin(thePlayer,playername) local player = getPlayerFromName(playername) if (player) then for i, v in pairs">pairs(player) do if getElementType(v) == "blip" then destroyElement(v) end end else outputChatBox("Player not found",thePlayer,255,0,0) end end addEvent("unmark", true) addEventHandler("unmark", getRootElement(), removePin) Link to comment
Kenix Posted March 13, 2012 Share Posted March 13, 2012 sckatchof, Can you show, how you trigger event ( unmark )? Link to comment
sckatchof Posted March 13, 2012 Author Share Posted March 13, 2012 @ Sparrow : it dont work but thnx for help @kenix : you mean that Client Side : ..... ButtonUnlocate = guiCreateButton(165,308,123,33,"UnPin",false,windowCP) .... .. function unmark() local rowindex, columnindex = guiGridListGetSelectedItem ( GriD ) playername = guiGridListGetItemText ( GriD, rowindex, 1) triggerServerEvent("unmark", getRootElement(), getLocalPlayer(), playername) end ... addEventHandler("onClientGUIClick", ButtonUnlocate, unmark) Link to comment
Kenix Posted March 13, 2012 Share Posted March 13, 2012 Check variable playername where you trigger to server. addEvent( "unmark", true ) function removePin( thePlayer,playername ) local player = getPlayerFromName( playername ) if player then outputChatBox 'Debug player: condition' for _, v in pairs( getAttachedElements( player ) ) do if getElementType( v ) == "blip" then destroyElement( v ) end end else outputChatBox( "Player not found",thePlayer,255,0,0 ) end end addEventHandler( "unmark", root, removePin ) Link to comment
sckatchof Posted March 13, 2012 Author Share Posted March 13, 2012 thank you kenix for help it work 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