sckatchof Posted March 13, 2012 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)
bandi94 Posted March 13, 2012 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) Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
sckatchof Posted March 13, 2012 Author 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)
Sparrow Posted March 13, 2012 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)
Kenix Posted March 13, 2012 Posted March 13, 2012 sckatchof, Can you show, how you trigger event ( unmark )? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted March 13, 2012 Author 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)
Kenix Posted March 13, 2012 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 ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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