Jump to content

help PLZ


sckatchof

Recommended Posts

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

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

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

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

@ 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...