Jump to content

problem vehicle gang


OrbTanT

Recommended Posts

This script is presenting the following error that I can't solve, when it is out of the gang and outside the area he does not enter the vehicle, and message appears, More was to occur only when entering or not in vehicle that are within the area

addEventHandler("onVehicleStartEnter", getRootElement(),  
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(GROVE)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[AVISO]#F08080 Este veiculo pertence a gang Grove Street.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[AVISO]#F08080 Este veiculo pertence a gang Grove Street.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 

Link to comment

Create a vehicle first , example

shinigami_noob = createVehicle ( your stuff )

later do this

addEventHandler("onVehicleStartEnter", shinigami_noob, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(GROVE)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[AVISO]#F08080 Este veiculo pertence a gang Grove Street.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[AVISO]#F08080 Este veiculo pertence a gang Grove Street.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 

Link to comment
Create a vehicle first , example

shinigami_noob = createVehicle ( your stuff )

later do this

  
shinigami_noob = createVehicle (your stuff ) 
  
addEventHandler("onVehicleStartEnter", shinigami_noob, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(GROVE)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[AVISO]#F08080 Este veiculo pertence a gang Grove Street.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[AVISO]#F08080 Este veiculo pertence a gang Grove Street.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 

Link to comment

Mmm, if I understand this good, you want to check or the vehicle is in your area?

Event 'onVehicleStartEnter' has a 'source' which is the vehicle which the player is trying to enter. So, you just use 'source':

local pX, pY, pZ = getElementPosition(source) 

With this, you can check or the positions are in or out of the area. If the player is not in the area, then use code:

cancelEvent() 

This will cancel the player with entering the vehicle.

Edited by Guest
Link to comment
Mmm, if I understand this good, you want to check or the vehicle is in your area?

Event 'onVehicleStartEnter' has a 'source' which is the vehicle which the player is trying to enter. So, you just use 'source':

local pX, pY, pZ = getElementPosition(source) 

With this, you can check or the positions are in or out of the area. If the player is not in the area, then use code:

cancelEvent() 

This will cancel the player with entering the vehicle.

I will test, thanks

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