Jump to content

Restriction


Drakath

Recommended Posts

Posted

How can I restrict this garage to open just for 1 player by his username?

Script:

local cjGarage = createColRectangle(2502.7883300781, -1698.60546875,5.8679199219,16.1025390625) 
addEventHandler("onColShapeHit",cjGarage,function(h) if getElementType(h) == "player" then setGarageOpen(9,true) local tpi = getElementData(cjGarage,"tpi") or 0 setElementData(cjGarage,"tpi",tpi+1,false) end end) 
addEventHandler("onColShapeLeave",cjGarage,function(h) if getElementType(h) == "player" then local tpi = getElementData(cjGarage,"tpi") or 0 if not tpi or tpi <= 1 then setGarageOpen(9,false)end setElementData(cjGarage,"tpi",tpi-1,false) end end) 

s.epicrow.com:22003.png

Posted
How can I restrict this garage to open just for 1 player by his username?

Script:

local cjGarage = createColRectangle(2502.7883300781, -1698.60546875,5.8679199219,16.1025390625) 
addEventHandler("onColShapeHit",cjGarage,function(h) if getElementType(h) == "player" then setGarageOpen(9,true) local tpi = getElementData(cjGarage,"tpi") or 0 setElementData(cjGarage,"tpi",tpi+1,false) end end) 
addEventHandler("onColShapeLeave",cjGarage,function(h) if getElementType(h) == "player" then local tpi = getElementData(cjGarage,"tpi") or 0 if not tpi or tpi <= 1 then setGarageOpen(9,false)end setElementData(cjGarage,"tpi",tpi-1,false) end end) 

maybe you can use

getAccountName 

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

Posted

Maybe this ? I dont know if you means just for a Player with a Name, or for a kind of Faction ?

getPlayerName 

Logic Fan <3

hhjfzck4mxhc.png

Posted
local cjGarage = createColRectangle(2502.7883300781, -1698.60546875,5.8679199219,16.1025390625) 
setElementData ( cjGarage, "owner", "Drakath" ) 
  
addEventHandler ( "onColShapeHit", cjGarage, 
    function ( h ) 
        if ( getElementType ( h ) == "player" ) then 
            if ( getElementData ( source, "owner" ) == getPlayerName ( h ) ) then 
                setGarageOpen ( 9, true ) 
                local tpi = getElementData ( cjGarage, "tpi" ) or 0 
                setElementData ( cjGarage, "tpi", ( tpi + 1 ), false ) 
            end 
        end 
    end 
) 
addEventHandler ( "onColShapeLeave", cjGarage, 
    function ( h ) 
        if ( getElementType ( h ) == "player" ) then 
            if ( getElementData ( source, "owner" ) == getPlayerName ( h ) ) then 
                local tpi = getElementData ( cjGarage, "tpi" ) or 0 
                if ( not tpi or tpi <= 1 ) then 
                    setGarageOpen ( 9, false ) 
                end 
                setElementData ( cjGarage, "tpi", ( tpi - 1 ), false ) 
            end 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...