OrbTanT Posted August 19, 2014 Share Posted August 19, 2014 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
xeon17 Posted August 19, 2014 Share Posted August 19, 2014 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
xeon17 Posted August 19, 2014 Share Posted August 19, 2014 Create a vehicle first , exampleshinigami_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
OrbTanT Posted August 19, 2014 Author Share Posted August 19, 2014 I am using a map with the cars, out of the area and within the area Link to comment
Et-win Posted August 19, 2014 Share Posted August 19, 2014 (edited) 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 August 19, 2014 by Guest Link to comment
xeon17 Posted August 19, 2014 Share Posted August 19, 2014 Use this: https://wiki.multitheftauto.com/wiki/IsInsideRadarArea Link to comment
OrbTanT Posted August 19, 2014 Author Share Posted August 19, 2014 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
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