CobbTheWarriorsRPG Posted October 15, 2013 Share Posted October 15, 2013 Hello im trying to made a base system, If you are in the specified gang you will be able to enter in the base, else if you don are in the gang you will be kicked to a position, ok Here is the problem If the guy enter and the guy are in the specified gang but are in a vehicle, the guy will be kicked (teleported) So i need help Please... The code client.lua secu = createColCuboid(1292.1208496094, 2072.3420410156, 10.217512130737, 198.5, 165, 25) function security () if not ( getElementData ( localPlayer, "gang" ) == "Testers") and isElementWithinColShape ( localPlayer, secu )then triggerServerEvent ( "onViolate", localPlayer ) end end addEventHandler ( "onColShapeHit", secu, security ) server.lua objeto = createObject ( 987, 1301.5999755859, 2099.1000976563, 10, 0, 0, 0 ) x,y,z = getElementPosition (objeto) col = createColCuboid(1302.3861083984, 2088.3466796875, 10.812677383423, 11.25, 11.25, 2) secu = createColCuboid(1292.1208496094, 2072.3420410156, 10.217512130737, 198.5, 165, 25) function Funcion ( player ) if ( getElementData ( player, "gang" ) == "Testers") then moveObject ( objeto, 10000, 1301.5, 2097.3994140625, 9.3000001907349-10 ) else outputChatBox("No perteneces a esta Gang") end end addEventHandler ( "onColShapeHit", col, Funcion ) function Funcion2 () moveObject ( objeto, 3000, 1301.5, 2097.3994140625, 9.3000001907349 ) end addEventHandler ( "onColShapeLeave", col, Funcion2 ) function secuServer ( ) setElementPosition ( source, 1270.8793945313, 2022.7806396484, 10.8203125 ) outputChatBox ( "No Perteneces a Este Clan", player, 255, 0, 0, true ) end addEventHandler ( "onViolate", secu, secuServer ) addEvent("onViolate", true ) Thanks. Link to comment
mint3d Posted October 15, 2013 Share Posted October 15, 2013 I am not sure beginner so i think you will need to trigger it with onClientVehicleEnter also Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 addEventHandler ( "onViolate", secu, secuServer ) change to: addEventHandler ( "onViolate", getRootElement(), secuServer ) And outputChatBox ( "No Perteneces a Este Clan", player, 255, 0, 0, true ) to: outputChatBox ( "No Perteneces a Este Clan", source, 255, 0, 0, true ) Link to comment
TAPL Posted October 16, 2013 Share Posted October 16, 2013 Try this. Also no need for the client side. -- Server Side -- objeto = createObject(987, 1301.5999755859, 2099.1000976563, 10, 0, 0, 0) col = createColCuboid(1302.3861083984, 2088.3466796875, 10.812677383423, 11.25, 11.25, 2) secu = createColCuboid(1292.1208496094, 2072.3420410156, 10.217512130737, 198.5, 165, 25) function Funcion(player) if getElementType(player) == "player" then if getElementData(player, "gang") == "Testers" then moveObject(objeto, 10000, 1301.5, 2097.3994140625, 9.3000001907349-10) else outputChatBox("No perteneces a esta Gang", player, 255, 0, 0) end end end addEventHandler("onColShapeHit", col, Funcion) function Funcion2() moveObject(objeto, 3000, 1301.5, 2097.3994140625, 9.3000001907349) end addEventHandler("onColShapeLeave", col, Funcion2) function secuServer(player) if getElementType(player) == "player" then if getElementData(player, "gang") ~= "Testers" then local vehicle = getPedOccupiedVehicle(player) if vehicle then setElementPosition(vehicle, 1270.8793945313, 2022.7806396484, 10.8203125) else setElementPosition(player, 1270.8793945313, 2022.7806396484, 10.8203125) end outputChatBox("No Perteneces a Este Clan", player, 255, 0, 0, true) end end end addEventHandler("onColShapeHit", secu, secuServer) 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