xUltimate Posted October 21, 2010 Share Posted October 21, 2010 Ok so I'm trying to make it so it detects if there in a certain area and then have them teleport it in to another area, but I also want it to detect if there in a vehicle that they teleport to a different area. I can't find out the certain functions for it (Yes I am new to LUA/MTA.) Here is the map info: <map edf:definitions="editor_main"> <object id="object (info) (1)" doublesided="false" model="1239" interior="0" dimension="0" posX="-2566.5703125" posY="553.54553222656" posZ="13.662875175476" rotX="0" rotY="0" rotZ="0" /> <object id="object (genint_warehs) (1)" doublesided="false" model="14784" interior="0" dimension="0" posX="-2558.8142089844" posY="517.38647460938" posZ="635.09411621094" rotX="0" rotY="0" rotZ="0" /> <object id="object (cn2_savgardr2_) (5)" doublesided="false" model="16501" interior="0" dimension="0" posX="-2530.3532714844" posY="551.5390625" posZ="628.78533935547" rotX="0" rotY="0" rotZ="0" /> <object id="object (arrow) (1)" doublesided="false" model="1318" interior="0" dimension="0" posX="-2533.4072265625" posY="551.16674804688" posZ="626.20599365234" rotX="0" rotY="0" rotZ="0" /> <object id="object (arrow) (2)" doublesided="false" model="1318" interior="0" dimension="0" posX="-2547.2822265625" posY="551.98864746094" posZ="626.19024658203" rotX="0" rotY="0" rotZ="270" /> </map> info is the enter area, arrow 1 is the area where players enter/leave the building. arrow 2 is the vehicle enter/exit. Please can someone help me. Link to comment
dzek (varez) Posted October 21, 2010 Share Posted October 21, 2010 not sure what you are trying to do? detect if player is sitting in vehicle, or to detect if on destination position there is any car (which makes player colliding with it on teleport) ? Link to comment
xUltimate Posted October 21, 2010 Author Share Posted October 21, 2010 not sure what you are trying to do?detect if player is sitting in vehicle, or to detect if on destination position there is any car (which makes player colliding with it on teleport) ? I want to find out how to detect there position, if there in a area, and if they are in a vehicle. Link to comment
dzek (varez) Posted October 21, 2010 Share Posted October 21, 2010 Still can't understand, sorry. Link to comment
Discord Moderators Zango Posted October 21, 2010 Discord Moderators Share Posted October 21, 2010 area? as it city area or your predefined one? surround it using a colshape. add the event onColShapeHit, check if the element is a player then warp, if the element is a vehicle, warp it. Link to comment
xUltimate Posted October 21, 2010 Author Share Posted October 21, 2010 varez, what I mean is somewhat like this: SA-MP: it was IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy) And: IsPlayerInVehicle(playerid,vehicleid) Now how can I use those functions in MTA SA? Link to comment
[DMC] Posted October 21, 2010 Share Posted October 21, 2010 here is an example my friend solidsnake made for me marker1 = createMarker (3079.3068847656, -2098.3444824219, 31.440458297729, "corona", 10, 255, 0, 0, getRootElement()) function teleport1(thePlayer) if source == marker1 then if isPedInVehicle(thePlayer) then local vehicle = getPedOccupiedVehicle(thePlayer) if getVehicleController(vehicle) == thePlayer then setElementPosition (vehicle, 3440.9497070313,-2223.5588378906,1.34375) end end end end addEventHandler("onMarkerHit", getRootElement(), teleport1) Link to comment
xUltimate Posted October 21, 2010 Author Share Posted October 21, 2010 here is an example my friend solidsnake made for me Ok, but now im stuck on how do change that to detect if there in a certain range Link to comment
dzek (varez) Posted October 21, 2010 Share Posted October 21, 2010 I think you forgot we have the wiki there.. https://wiki.multitheftauto.com/wiki/Cli ... _Functions https://wiki.multitheftauto.com/wiki/Ser ... _Functions IsPlayerInArea -> isElementWithinColShape (you have to create colshape first! there are much types of colshapes - choose the one most suiting you - click) IsPlayerInVehicle -> isPedInVehicle (i see you are checking for specific vehicle in SAMP - here you are checking if player is in any vehicle - to get player vehicle use getPedOccupiedVehicle - it will return vehicle elemnt or false if player is not in vehicle - you can use this instead of isPedInVehicle too) Link to comment
[DMC] Posted October 21, 2010 Share Posted October 21, 2010 here is an example my friend solidsnake made for me Ok, but now im stuck on how do change that to detect if there in a certain range i dont know what you mean but i do know its working when you drive in the maker Link to comment
xUltimate Posted October 21, 2010 Author Share Posted October 21, 2010 I fixed it guys but now im stuck with something. I created a actual interior, but when a car goes through it it sets the dimension but not the pos for yourself and the car, same with when you leave the interior in a car. Link to comment
dzek (varez) Posted October 21, 2010 Share Posted October 21, 2010 show us your code, so we can fix it.. Link to comment
xUltimate Posted October 21, 2010 Author Share Posted October 21, 2010 show us your code, so we can fix it.. It was apart of this base GM I downloaded, just found out I could do /createint but I believe its this code local function loadInterior( id, outsideX, outsideY, outsideZ, outsideInterior, outsideDimension, insideX, insideY, insideZ, insideInterior, interiorName, interiorPrice, interiorType, characterID, locked, dropoff ) local outside = createColSphere( outsideX, outsideY, outsideZ, 1 ) setElementInterior( outside, outsideInterior ) setElementDimension( outside, outsideDimension ) setElementData( outside, "name", interiorName ) -- we only need it set in case there's really something for sale if interiorType ~= 0 and characterID <= 0 then setElementData( outside, "type", interiorType ) setElementData( outside, "price", interiorPrice ) end local inside = createColSphere( insideX, insideY, insideZ, 1 ) setElementInterior( inside, insideInterior ) setElementDimension( inside, id ) colspheres[ outside ] = { id = id, other = inside } colspheres[ inside ] = { id = id, other = outside } interiors[ id ] = { inside = inside, outside = outside, name = interiorName, type = interiorType, price = interiorPrice, characterID = characterID, locked = locked, blip = not locked and outsideDimension == 0 and not getElementData( outside, "price" ) and createBlipEx( outside, inside ), dropoff = dropoff } end Link to comment
xUltimate Posted October 22, 2010 Author Share Posted October 22, 2010 Sorry for double post. Can anyone help? Link to comment
dzek (varez) Posted October 22, 2010 Share Posted October 22, 2010 no need to say sorry, just don't bump your posts after only few hours.. Link to comment
xUltimate Posted October 22, 2010 Author Share Posted October 22, 2010 no need to say sorry, just don't bump your posts after only few hours.. Heh. ok. 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