Security - Remove Weapons

Yes, I’ve achieved something similar for my flightschool module.

Basically, I’ve used interiors. Interiors are great because it’s a way to measure proximity, being in an actual room, or anything similar.

For me what I did was along the lines of:
Get interior player is in
If interior player is in == “INSERT_INTERIOR_HERE” then
disable all controls related to weapons, sprinting, jumping, etc…

What you’re trying to do is getting rid of weapons…this is where it gets a bit more complex…
Are you trying to return the player’s weapons once they leave the door, or will the weapons just disappear?

If you want to return the weapons, it’s gonna get a lot more complex as you’ll need to record that data, and give the player BACK that data (this model may be subject to security issues, but you’ll have to figure out how to secure, and validate such items upon return…that is IF you decide to go that route…)

All of this is assuming that the door you’re trying to enter IS in fact an interior…not sure how you’d do it otherwise…maybe someone can make a suggestion.

However, IF what you’re trying to do is interior related, here’s a codesnippet I use directly to get such information. There are 4 natives here.

function updateplayerdata(plyr)
        local player = GetPlayerPed(-1)
        local playerp = GetEntityCoords(plyr)
        local int = GetInteriorAtCoords(playerp)
        local introomid = GetRoomKeyFromEntity(plyr)
        return player, playerp, int, introomid
end

Hopefully the code is self explanatory, but if not, please feel free to reach out.

Also, to understand how this function works, I’d recommend walking into various interiors (Devin Westin hangar, Floyd’s house, Michael’s Mansion, Frankline’s Aunt’s house, custom interiors, etc) and printing the values in the function to the screen to see how this function handles the player entering different interiors. Once you’re fairly comfortable with how it works, start using it in your code…

If you have q’s about the snippet, ask here!
Good luck on your solution, and happy scripting!