Jump to content

Search the Community

Showing results for tags 'door'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RAGE Multiplayer
    • Announcements
    • Discussion
    • Suggestions
  • Scripting
    • Scripting
    • Resources
  • Community
    • Support
    • Servers
    • Media Gallery
  • Non-English
    • Русский - Russian
    • Français - French
    • Deutsch - German
    • Espanol - Spanish
    • Română - Romanian
    • Portuguesa - Portuguese
    • Polski - Polish

Categories

  • Scripts
  • Gamemodes
  • Libraries
  • Plugins
  • Maps
  • Tools

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Youtube


Skype


Web


VK

Found 2 results

  1. Version 1.0.1

    3617 downloads

    This resource will sync basic things for you such as the doors, windows, tyres, engine, dirt, and lock status. Note that this resource incorporates the disabling of automatic engine toggle. If you get in a car you can only start it by script commands. There are several API functions provided for you to use. Read up on how to use this resource here; https://wiki.gtanet.work/index.php?title=Getting_started_with_Basic_Vehicle_Sync_Resource
  2. I developed a server in the past on GT:MP and there was a really nice DoorManger to find out the door hashes easy inGame. I don't know all the client side (JS) differences and details in RageMP, so maybe one of the Guru's can help here on modify the script to RageMP, I'm sure lots of people would like it, me too Enlosed the GT:MP Version for the DoorManager: (orignal by Guadmaz) This script is not for RAGE:MP ServerSide (CS) using System.Linq; using System.Collections.Generic; using GrandTheftMultiplayer.Server.API; using GrandTheftMultiplayer.Server.Elements; using GrandTheftMultiplayer.Server.Managers; using GrandTheftMultiplayer.Shared; using GrandTheftMultiplayer.Shared.Math; public class DoorManager : Script { public DoorManager() { API.onEntityEnterColShape += ColShapeTrigger; API.onClientEventTrigger += ClientEventTrigger; } private int _doorCounter; private Dictionary<int, ColShape> _doorColShapes = new Dictionary<int, ColShape>(); private bool _debugStatus = true; public const ulong SET_STATE_OF_CLOSEST_DOOR_OF_TYPE = 0xF82D8F1926A02C3D; [Command("getdoor")] public void Debug_GetDoorCMD(Client sender) { if (!_debugStatus) return; API.triggerClientEvent(sender, "doormanager_debug"); } [Command("getdoorex")] public void Debug_GetDoorExCMD(Client sender, string modelName) { if (!_debugStatus) return; var pos = API.getEntityPosition(sender); API.triggerClientEvent(sender, "doormanager_finddoor_return", API.getHashKey(modelName), pos); } [Command("createDoor")] public void Debug_CreateDoorCMD(Client sender, int model) { if (!_debugStatus) return; var pos = API.getEntityPosition(sender); var id = registerDoor(model, pos); API.sendChatMessageToPlayer(sender, "Your door id is " + id); } [Command("createDoorEx")] public void Debug_CreateDoorExCMD(Client sender, string modelName, float x, float y, float z) { if (!_debugStatus) return; var pos = new Vector3(x, y, z); var model = API.getHashKey(modelName); var id = registerDoor(model, pos); API.sendChatMessageToPlayer(sender, "Your door id is " + id); } [Command("setdoorstate")] public void Debug_SetDoorStateCMD(Client sender, int doorId, bool locked, float heading) { if (!_debugStatus) return; setDoorState(doorId, locked, heading); } [Command("findobj")] public void Debug_FindDoorCMD(Client sender, int model) { if (!_debugStatus) return; var pos = API.getEntityPosition(sender); API.triggerClientEvent(sender, "doormanager_finddoor", model, pos); } [Command("findobjname")] public void Debug_FindDoorByNameCMD(Client sender, string modelName) { if (!_debugStatus) return; var model = API.getHashKey(modelName); var pos = API.getEntityPosition(sender); API.triggerClientEvent(sender, "doormanager_finddoor", model, pos); } [Command("transition")] public void Debug_TransitionDoorCMD(Client sender, int doorid, float target, int time) { transitionDoor(doorid, target, time); } private void ClientEventTrigger(Client sender, string eventName, object[] args) { if (eventName == "doormanager_debug_createdoor") { if (!_debugStatus) return; var model = (int) args[0]; var pos = (Vector3) args[1]; var id = registerDoor(model, pos); API.sendChatMessageToPlayer(sender, "Your door id is " + id); } } private void ColShapeTrigger(ColShape colshape, NetHandle entity) { var player = API.getPlayerFromHandle(entity); if (player == null) return; if (colshape != null && colshape.getData("IS_DOOR_TRIGGER") == true) { var id = colshape.getData("DOOR_ID"); var info = colshape.getData("DOOR_INFO"); float heading = 0f; if (info.State != null) heading = info.State; API.sendNativeToPlayer(player, SET_STATE_OF_CLOSEST_DOOR_OF_TYPE, info.Hash, info.Position.X, info.Position.Y, info.Position.Z, info.Locked, heading, false); } } /* EXPORTED METHODS */ public int registerDoor(int modelHash, Vector3 position) { var colShapeId = ++_doorCounter; var info = new DoorInfo(); info.Hash = modelHash; info.Position = position; info.Locked = false; // Open by default; info.Id = colShapeId; info.State = 0; var colShape = API.createSphereColShape(position, 35f); colShape.setData("DOOR_INFO", info); colShape.setData("DOOR_ID", colShapeId); colShape.setData("IS_DOOR_TRIGGER", true); _doorColShapes.Add(colShapeId, colShape); return colShapeId; } public void transitionDoor(int doorId, float finish, int ms) { if (_doorColShapes.ContainsKey(doorId)) { var info = _doorColShapes[doorId].getData("DOOR_INFO"); info.Locked = true; foreach (var entity in _doorColShapes[doorId].getAllEntities()) { var player = API.getPlayerFromHandle(entity); if (player == null) continue; API.triggerClientEvent(player, "doormanager_transitiondoor", info.Hash, info.Position, info.State, finish, ms); } info.State = finish; } } public void refreshDoorState(int doorId) { if (_doorColShapes.ContainsKey(doorId)) { var info = _doorColShapes[doorId].getData("DOOR_INFO"); float heading = info.State; foreach (var entity in _doorColShapes[doorId].getAllEntities()) { var player = API.getPlayerFromHandle(entity); if (player == null) continue; API.sendNativeToPlayer(player, SET_STATE_OF_CLOSEST_DOOR_OF_TYPE, info.Hash, info.Position.X, info.Position.Y, info.Position.Z, info.Locked, heading, false); } } } public void removeDoor(int id) { if (_doorColShapes.ContainsKey(id)) { API.deleteColShape(_doorColShapes[id]); _doorColShapes.Remove(id); } } public void setDoorState(int doorId, bool locked, float heading) { if (_doorColShapes.ContainsKey(doorId)) { var door = _doorColShapes[doorId]; var data = door.getData("DOOR_INFO"); data.Locked = locked; data.State = heading; door.setData("DOOR_INFO", data); foreach (var entity in door.getAllEntities()) { var player = API.getPlayerFromHandle(entity); if (player == null) continue; float cH = data.State; API.sendNativeToPlayer(player, SET_STATE_OF_CLOSEST_DOOR_OF_TYPE, data.Hash, data.Position.X, data.Position.Y, data.Position.Z, data.Locked, cH, false); } } } public int getCloseDoor(Client player) { var localCopy = new Dictionary<int, ColShape>(_doorColShapes); return localCopy.FirstOrDefault(pair => pair.Value.containsEntity(player)).Key; } public int[] getAllCloseDoors(Client player) { var localCopy = new Dictionary<int, ColShape>(_doorColShapes); var list = new List<int>(); foreach (var sh in localCopy) { if (sh.Value.containsEntity(player)) list.Add(sh.Key); } return list.ToArray(); } public void setDebug(bool status) { _debugStatus = status; } } public struct DoorInfo { public int Hash; public Vector3 Position; public int Id; public bool Locked; public float State; } CLIENTSIDE (JS) var selectingDoor = false; var lastDoor = null; var lastDoorV = 0; var currentTransitions = []; API.onServerEventTrigger.connect(function(eventName, args) { if (eventName == "doormanager_debug") { selectingDoor = true; API.showCursor(true); } else if (eventName == "doormanager_finddoor") { var doorHash = args[0]; var pos = args[1]; var handle = API.returnNative("GET_CLOSEST_OBJECT_OF_TYPE", 9, pos.X, pos.Y, pos.Z, 10.5, doorHash, false, true, true); if (!handle.IsNull) { API.sendChatMessage("Found model at " + API.getEntityPosition(handle).ToString()); var mark = API.createMarker(28, API.getEntityPosition(handle), new Vector3(), new Vector3(), new Vector3(0.1, 0.1, 0.1), 255, 255, 255, 100); API.sleep(3000); API.deleteEntity(mark); } } else if (eventName == "doormanager_finddoor_return") { var doorHash = args[0]; var pos = args[1]; var handle = API.returnNative("GET_CLOSEST_OBJECT_OF_TYPE", 9, pos.X, pos.Y, pos.Z, 10.5, doorHash, false, true, true); if (!handle.IsNull) { API.triggerServerEvent("doormanager_debug_createdoor", API.getEntityModel(handle), API.getEntityPosition(handle)); } } else if (eventName == "doormanager_transitiondoor") { var model = args[0]; var pos = args[1]; var start = args[2]; var end = args[3]; var duration = args[4]; currentTransitions.push({ 'model' : model, 'pos' : pos, 'start' : start, 'end' : end, 'duration' : duration, 'startTime' : API.getGlobalTime(), }) } }); API.onUpdate.connect(function() { if (currentTransitions.length > 0) { for (var i = currentTransitions.length - 1; i >= 0; i--) { var delta = API.getGlobalTime() - currentTransitions.startTime; if (delta > currentTransitions.duration) { API.callNative("SET_STATE_OF_CLOSEST_DOOR_OF_TYPE", currentTransitions.model, currentTransitions.pos.X, currentTransitions.pos.Y, currentTransitions.pos.Z, true, API.f(currentTransitions.end), false); currentTransitions.splice(i, 1); } else { API.callNative("SET_STATE_OF_CLOSEST_DOOR_OF_TYPE", currentTransitions.model, currentTransitions.pos.X, currentTransitions.pos.Y, currentTransitions.pos.Z, true, API.f(API.lerpFloat(currentTransitions.start, currentTransitions.end, delta, currentTransitions.duration)), false); } }; } if (selectingDoor) { var cursOp = API.getCursorPositionMaintainRatio(); var s2w = API.screenToWorldMaintainRatio(cursOp); var rayCast = API.createRaycast(API.getGameplayCamPos(), s2w, -1, null); var localH = null; var localV = 0; if (rayCast.didHitEntity) { localH = rayCast.hitEntity; localV = localH.Value; } API.displaySubtitle("Object Handle: " + localV); if (localV != lastDoorV) { if (localH != null) API.setEntityTransparency(localH, 50); if (lastDoor != null) API.setEntityTransparency(lastDoor, 255); lastDoor = localH; lastDoorV = localV; } if (API.isDisabledControlJustPressed(24)) { API.showCursor(false); selectingDoor = false; if (localH != null) { API.sendChatMessage("Object model is " + API.getEntityModel(localH)); API.triggerServerEvent("doormanager_debug_createdoor", API.getEntityModel(localH), API.getEntityPosition(localH)); } } } else if (lastDoor != null) { API.setEntityTransparency(lastDoor, 255); lastDoor = null; } });
×
×
  • Create New...