Jump to content

How to create anti-gravitygun script?


Turbe$Z

Recommended Posts

You should use this:

--Add this to the serverfile:

function antigravitygun(player)
	if not getElementData(player, "antigravitygun") then
		setElementData(player, "antigravitygun", true)
		outputChatBox("You have succesfully turned off 'Gravity Gun'!",player,255,0,0)
	else
		setElementData(player, "antigravitygun", false)
		outputChatBox("You have succesfully turned on 'Gravity Gun'!",player,0,255,0)
	end
end
addCommandHandler("antigg", antigravitygun)

--And this to the client:
if getElementData(localPlayer, "antigravitygun") then return end

--This one has to be between these two:
if not getControlState("aim_weapon") or isElementInWater(localPlayer) then return end --(Row: 23)
local ggun_obj = getElementData(localPlayer,"ggun_taken") --(Row: 24)

--So it should look like this:
if not getControlState("aim_weapon") or isElementInWater(localPlayer) then return end --(Row: 23)
if getElementData(localPlayer, "antigravitygun") then return end --(Row: 24)
local ggun_obj = getElementData(localPlayer,"ggun_taken") --(Row: 25)

 

  • Like 1
Link to comment
37 minutes ago, DREFTHUN said:

You should use this:


--Add this to the serverfile:

function antigravitygun(player)
	if not getElementData(player, "antigravitygun") then
		setElementData(player, "antigravitygun", true)
		outputChatBox("You have succesfully turned off 'Gravity Gun'!",player,255,0,0)
	else
		setElementData(player, "antigravitygun", false)
		outputChatBox("You have succesfully turned on 'Gravity Gun'!",player,0,255,0)
	end
end
addCommandHandler("antigg", antigravitygun)

--And this to the client:
if getElementData(localPlayer, "antigravitygun") then return end

--This one has to be between these two:
if not getControlState("aim_weapon") or isElementInWater(localPlayer) then return end --(Row: 23)
local ggun_obj = getElementData(localPlayer,"ggun_taken") --(Row: 24)

--So it should look like this:
if not getControlState("aim_weapon") or isElementInWater(localPlayer) then return end --(Row: 23)
if getElementData(localPlayer, "antigravitygun") then return end --(Row: 24)
local ggun_obj = getElementData(localPlayer,"ggun_taken") --(Row: 25)

 

thanks :D

Link to comment
--Clientside:

if getElementData(getPedTarget(localPlayer), "antigravitygun") then return end

--It has to look like this:
if isElement(ggun_obj) and isTimer(buildupTimer) then --(Row: 30)
		if not isElement(ggun_obj) then ggun_obj = getPedTarget(localPlayer) end --(Row: 31)
  		if getElementData(getPedTarget(localPlayer), "antigravitygun") then return end --(Row: 32)

 

Though, others can still lift the vehicle you are sitting in.

Link to comment
3 minutes ago, DREFTHUN said:

--Clientside:

if getElementData(getPedTarget(localPlayer), "antigravitygun") then return end

--It has to look like this:
if isElement(ggun_obj) and isTimer(buildupTimer) then --(Row: 30)
		if not isElement(ggun_obj) then ggun_obj = getPedTarget(localPlayer) end --(Row: 31)
  		if getElementData(getPedTarget(localPlayer), "antigravitygun") then return end --(Row: 32)

 

players still can lift me :S 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...