GTX Posted December 26, 2012 Share Posted December 26, 2012 Hello, as you may know, there's a bug in race ghostmode. When I'm trying to enable/disable ghostmode, it just doesn't... Any ideas? I tried many options and none of them did actualy work properly: #1: function GM(player) if not isGuestAccount(getPlayerAccount(player)) and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup"Admin") then if getElementData(player, "overrideCollide.uniqueblah") == nil or not getElementData(player, "overrideCollide.uniqueblah") then for i, v in ipairs(getElementsByType"player") do setElementData(v, "overrideCollide.uniqueblah", 0, true) end outputChatBox('* Ghostmode enabled by ' .. getPlayerName(player), root, 0, 255, 0) else for i, v in ipairs(getElementsByType"player") do setElementData(v, "overrideCollide.uniqueblah", nil, true) end outputChatBox('* Ghostmode disabled by ' .. getPlayerName(player), root, 255, 0, 0) end end end addCommandHandler('gm', GM) addCommandHandler('ghostmode', GM) - Doesn't disable/enable. #2: function GM(player) if not isGuestAccount(getPlayerAccount(player)) and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup"Admin") then for i, v in ipairs(getElementsByType"player") do if getElementCollisionsEnabled(getPedOccupiedVehicle(v)) then setElementCollisionsEnabled(getPedOccupiedVehicle(v), false) outputChatBox('* Ghostmode disabled by ' .. getPlayerName(player), v, 255, 0, 0) else setElementCollisionsEnabled(getPedOccupiedVehicle(v), true) outputChatBox('* Ghostmode enabled by ' .. getPlayerName(player), root, 0, 255, 0) end end end end addCommandHandler('gm', GM) addCommandHandler('ghostmode', GM) - Strange bug... When it disables, I can fly and texture/model of the car is... messing somehow. Screenshots: - http://shrani.si/f/26/bP/utJ6Dn5/mta-sc ... 2616-2.png (LOL) Thanks in advance. Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 Of course you can "fly", because you disabled the vehicle collisions, that's the wrong function, you must use: setElementCollidableWith Link to comment
GTX Posted December 26, 2012 Author Share Posted December 26, 2012 Ah woopsie. Okay, I got it now. But I got a strange error in this code: function GM() for i, v in ipairs(getElementsByType"vehicle") do if isElementCollidableWith(v, v) == true then setElementCollidableWith(v, v, false) else setElementCollidableWith(v, v, true) end end end addCommandHandler("gm", GM) But wtf... Error: attempt to call global 'isElementCollidableWith' (a nil value) Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 You obviously put this script as server side, these two functions are client side only. Link to comment
GTX Posted December 26, 2012 Author Share Posted December 26, 2012 Oh lol. I was confused.. Well, thanks! Link to comment
GTX Posted December 26, 2012 Author Share Posted December 26, 2012 Uhm, I tried with the code below, but it doesn't work... What can I do? function GM() for i, v in ipairs(getElementsByType"vehicle") do if isElementCollidableWith(v, v) then setElementCollidableWith(v, v, false) else setElementCollidableWith(v, v, true) end end end addCommandHandler("gm", GM) Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 function GM ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if ( vehicle ) then for _, v in ipairs ( getElementsByType"vehicle" ) do setElementCollidableWith ( v, vehicle, not isElementCollidableWith ( v, vehicle ) ) end end end addCommandHandler ( "gm", GM ) Try that. Link to comment
novo Posted December 28, 2012 Share Posted December 28, 2012 function GM ( ) for i,r in ipairs(getElementsByType("player")) do local vehicle = getPedOccupiedVehicle ( r ) if ( vehicle ) then for _, v in ipairs ( getElementsByType"vehicle" ) do setElementCollidableWith ( v, vehicle, not isElementCollidableWith ( v, vehicle ) ) end end end end addCommandHandler ( "gm", GM ) 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