Jump to content

GODMODE IF SETPLAYER


orcun99

Recommended Posts

 


createTeam("GOD", 0, 255, 0)



function tablo(thePlayer)
local state = ( not getElementData ( thePlayer, "invincible" ) )
    setElementData ( thePlayer, "invincible", state )
		local asd = getTeamFromName("GOD")
	setPlayerTeam(thePlayer, asd)
outputChatBox ( "#ffff00Ölümsüzük -> ".. ( state and "#00ff00Açıldı" or "#ff0000Kapandı" ) .."", thePlayer, 0, 255, 0,true)
end
addCommandHandler("god",tablo)

client.lua

addEventHandler ( "onClientPlayerDamage",root,
function ()
    if getElementData(source,"invincible") then
        cancelEvent()
    end
end)
 
 
 function deneme()
   if getElementData(source,"invincible") then
 	    triggerServerEvent ( "qwe", resourceRoot, "Hello World!" )
		end
		end
		



addEventHandler("onClientPlayerStealthKill",localPlayer,
function (targetPlayer)
    if getElementData(targetPlayer,"invincible") then
        cancelEvent()
    end
end)




imgW = 367
imgH = 91
function adminLogo()
    local players = getPlayersInTeam(getTeamFromName("GOD"))
    for i,player in ipairs(players) do
        if player ~= localPlayer then
            local cX, cY, cZ = getCameraMatrix()
            local hX, hY, hZ = getPedBonePosition(player, 8)
            hZ = hZ + 0.5
            local pX,pY,pZ = getPedBonePosition(localPlayer, 8)
            pZ = pZ + 0.5
            if getScreenFromWorldPosition(hX, hY, hZ) and isLineOfSightClear(cX,cY,cZ, pX,pY,pZ) then
                local sX, sY, sD = getScreenFromWorldPosition(hX, hY, hZ)
                local relative = (50 - sD) / 50
                if relative > 0 then
                    local iW = imgW * relative
                    local iH = imgH * relative

                    local iX = sX - (iW / 2)
                    local iY = sY - (iH / 2)

                    dxDrawImage(iX, iY, iW, iH, "logo.png")
                end
            end
        end
    end
end
addEventHandler("onClientRender", root, adminLogo)

 

 

I need if godmode on and he command /god again  turn off god  it's okay but I need add If god off then setplayerteam(theplayer,source) need help 

when u turn off godmode state  turn off logo I need this

and one more think   if player in godmode than can't attack other players

Edited by orcun99
Link to comment

You want to remove the player from the team if the state is false? Wiki says that in order to remove a player from a team, the team should be nil, so that could be done like this:

setPlayerTeam(thePlayer, (state and asd or nil)) --Great variable name btw...
Quote

when u turn off godmode state  turn off logo I need this

I have no idea what that means.

Quote

and one more think   if player in godmode than can't attack other players

That's really simple, there is a function called toggleControl that toggles a control :-o. So all that has to be done is this:

toggleControl(thePlayer, "fire", not state) --Will toggle the control opposite to state, ie. state is true (godmode on) then control is false (disabled)

 

  • Thanks 1
Link to comment
1 hour ago, MIKI785 said:

You want to remove the player from the team if the state is false? Wiki says that in order to remove a player from a team, the team should be nil, so that could be done like this:


setPlayerTeam(thePlayer, (state and asd or nil)) --Great variable name btw...

I have no idea what that means.

That's really simple, there is a function called toggleControl that toggles a control :-o. So all that has to be done is this:


toggleControl(thePlayer, "fire", not state) --Will toggle the control opposite to state, ie. state is true (godmode on) then control is false (disabled)

 

thank u very much.

works

Edited by orcun99
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...