huyjvguyen Posted August 2, 2015 Share Posted August 2, 2015 scrip to keep player can not move.?? Link to comment
Mr.Aleks Posted August 2, 2015 Share Posted August 2, 2015 setElementFrozen The function you should use. Link to comment
XeRo Posted August 2, 2015 Share Posted August 2, 2015 Example; function toggleFreezeStatus ( thePlayer ) -- if he is in a vehicle, if getPedOccupiedVehicle ( thePlayer ) then -- get the vehicle element local playerVehicle = getPlayerOccupiedVehicle ( thePlayer ) -- get the current freeze status local currentFreezeStatus = isElementFrozen ( playerVehicle ) -- get the new freeze status (the opposite of the previous state) local newFreezeStatus = not currentFreezeStatus -- set the new freeze status setElementFrozen ( playerVehicle, newFreezeStatus ) end end Link to comment
huyjvguyen Posted August 2, 2015 Author Share Posted August 2, 2015 i need exaple, when player A nearby player B , player A can freezy player B? Link to comment
GTX Posted August 2, 2015 Share Posted August 2, 2015 function onCommand(playerA, command, playerB) playerB = findPlayer(playerB) local xA, yA, zA = getElementPosition(playerA) local xB, yB, zB = getElementPosition(playerB) if getDistanceBetweenPoints3D(xA, yA, zA, xB, yB, zB) <= 10 then setElementFrozen(playerB, true) end end addCommandHandler("freezeB", onCommand) function findPlayer(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end 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