Jump to content

Criminal Team


Hero192

Recommended Posts

Hello guys, my problem is i want to let only the Criminal team who click the ped and get the gui but in this code criminal team and non criminal team are not able to take the job

i tried also with

if getTeamName(getPlayerTeam(element)) == "Criminal" then returns 

but it doesn't works too ,any one have an idea please?

function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if element and getElementType(element) == "ped" and state=="down" and button=="left" then 
        local x, y, z = getElementPosition(element) 
        if getTeamName(getPlayerTeam(element)) ~= "Criminal" then outputChatBox("You must be criminal .",255,0,0) return end 
        if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
        guiSetVisible(Window,true) 
               end 
         end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onPedClick,true ) 

WARNING: Bad argument @ 'getPlayerTeam'[expected player at argument 1,got ped)

Edited by Guest
Link to comment

Try this.

function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    local pTeam = getPlayerTeam ( element ) 
    if pTeam then 
    local tName = getTeamName(pTeam) 
        local x, y, z = getElementPosition(element) 
        if ( tName ~= "Criminal" ) then 
            cancelEvent() 
            outputChatBox("You must be criminal .",255,0,0)  
        else     
        if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
        guiSetVisible(Window,true) 
               end 
         end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onPedClick) 

Link to comment
LINE NUMBER ON/OFF | EXPAND/CONTRACT | SELECT ALL 
function onPedClick(button, state, absX, absY, wx, wy, wz, player) 
    local pTeam = getPlayerTeam ( player ) 
    if pTeam then 
    local tName = getTeamName(pTeam) 
        local x, y, z = getElementPosition(player) 
        if ( tName ~= "Criminal" ) then 
            cancelEvent() 
            outputChatBox("You must be criminal .",255,0,0) 
        else    
        if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
        guiSetVisible(Window,true) 
               end 
         end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onPedClick) 

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...