Jump to content

2 question


Zokan

Recommended Posts

Posted

Hello people I have a few questions

1.I am looking for a script that takes away someone's jetpack when he flies into a specific area or as long as he's in there also may get none at all ....

Is there such a script?

2. I've created a script. It should create a Col or delete the Col with a command. The delete works but does not create the why? Here's the script:

g_base_col = createColCuboid ( 130.09884643555, -2079.8127441406, -10,  250, 300, 500 ) 
  
function colhin ( pla )  
          if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
       destroyElement ( g_base_col ) 
end 
end 
end 
addCommandHandler ( "set", colhin ) 
  
function colhin1 ( pla )  
          if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
       g_base_col = createColCuboid ( 130.09884643555, -2079.8127441406, -10,  250, 300, 500 ) 
end 
end 
end 
addCommandHandler ( "set1", colhin1 ) 
  

MFG

Zokan

Posted

Commands

/createcol - creates a colCuboid

/deletecol - deletes a colCuboid that was created before

function createCol(player, cmd) 
    if getElementType(player) == "player" then 
        if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
            if not g_base_col then 
                g_base_col = createColCuboid(130.09884643555, -2079.8127441406, -10,  250, 300, 500) 
            else 
                outputChatBox("Error happened: collision shape is already created, delete it first.", player, 255, 0, 0, false) 
            end 
        end 
    end 
end 
addCommandHandler("createcol", createCol) 
  
function deleteCol(player, cmd) 
    if getElementType(player) == "player" then 
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
            if g_base_col then 
                destroyElement(g_base_col) 
            else 
                outputChatBox("Error happened: collision shape is not created yet.", player, 255, 0, 0, false) 
            end 
        end 
    end 
end 
addCommandHandler("deletecol", deleteCol) 

If I helped you, please click the like button on the right ;) Thanks!

Posted

That does not work with the jetpack he does not get it taken away

Here's my script:

function hit ( pla, source ) 
    if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
                outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                            if ( doesPedHaveJetPack ( source ) ) then 
                            removePedJetPack ( source ) 
                outputChatBox ( "***Admin Area***", pla, 255, 0, 0 ) 
                outputChatBox ( "* "..getPlayerName(pla).." has entered the Admin Area!", g_root, 255, 0, 0 )    
                outputChatBox ( "* "..getPlayerName(pla).." please left the Admin Area!", pla, 255, 0, 0 )   
end 
end 
        end 
    end 
addEventHandler ( "onColShapeHit", g_base_col, hit ) 

error message:

Warning: test/test.lua:42: Bad argument @ ´doesPedHaveJetPack`

Posted
  
function hit ( pla, source ) 
    if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
                outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                            if ( doesPedHaveJetPack ( pla ) ) then 
                            removePedJetPack ( pla ) 
                outputChatBox ( "***Admin Area***", pla, 255, 0, 0 ) 
                outputChatBox ( "* "..getPlayerName(pla).." has entered the Admin Area!", g_root, 255, 0, 0 )    
                outputChatBox ( "* "..getPlayerName(pla).." please left the Admin Area!", pla, 255, 0, 0 )   
end 
end 
        end 
    end 
addEventHandler ( "onColShapeHit", g_base_col, hit ) 

try it , changed from source -- to pla

My Projects!

No one.

Posted

make a settimer to check every 1 second if the player has a jetpack.

setTimer() 
doesPedHaveJetPack() 
removePedJetPack()  

aka.

setTimer( 
function timer() 
if doesPedHaveJetPack(getLocalPlayer()) then 
removePedJetPack(getLocalPlayer()) 
end 
end ,1000,0 ) 

Posted

ok I have it now so every second but then comes an error message can someone help me pls would be nice:)

Script:

    function jetweg( pla, source ) 
    if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
    else 
    if ( doesPedHaveJetPack ( pla ) ) then 
    removePedJetPack ( pla ) 
    end 
    end  
end 
end 
    addEventHandler ( "onColShapeHit", g_base_col, jetweg ) 
  
    setTimer( jetweg, 1000,0 ) 

Posted

I have it now so I can still get a jetpack in the Col. Error messages are not ...

function ColShapeHit ( thePlayer, matchingDimension ) 
    local detection = isElementWithinColShape ( thePlayer, g_base_col ) 
    if detection then 
    if ( doesPedHaveJetPack ( thePlayer ) ) then 
    removePedJetPack ( thePlayer ) 
    end 
end 
end 
addEventHandler ( "onColShapeHit", g_base_col, ColShapeHit ) 

Posted
function ColShapeHit ( thePlayer, matchingDimension ) 
    local detection = isElementWithinColShape ( thePlayer, g_base_col ) 
    if detection then 
    if ( doesPedHaveJetPack ( thePlayer ) ) then 
    removePedJetPack ( thePlayer ) 
    end 
end 
end 
addEventHandler ( "onClientRender", ColShapeHit ) 

Try this

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted (edited)
  
function ColShapeHit ( thePlayer, matchingDimension ) 
if isElementWithinColShape(source,nameofcol) == true then 
if ( doesPedHaveJetPack ( thePlayer ) ) then 
    removePedJetPack ( thePlayer ) 
end 
end 
end 
addEventHandler ( "onClientRender", ColShapeHit ) 

Edited by Guest

My Projects!

No one.

Posted
  
function hit ( pla, source ) 
    if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
                outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                            if ( doesPedHaveJetPack ( pla ) ) then 
                            removePedJetPack ( pla ) 
                outputChatBox ( "***Admin Area***", pla, 255, 0, 0 ) 
                outputChatBox ( "* "..getPlayerName(pla).." has entered the Admin Area!", g_root, 255, 0, 0 )    
                outputChatBox ( "* "..getPlayerName(pla).." please left the Admin Area!", pla, 255, 0, 0 )   
end 
end 
        end 
    end 
addEventHandler ( "onColShapeHit", g_base_col, hit ) 
  
  
function ColShapeHit ( thePlayer, matchingDimension ) 
if isElementWithinColShape(source,g_base_col) == true then 
if ( doesPedHaveJetPack ( thePlayer ) ) then 
    removePedJetPack ( thePlayer ) 
end 
end 
end 
addEventHandler ( "onClientRender", ColShapeHit ) 

-- Complete script

REMEMBER:SERVER-SIDE

My Projects!

No one.

Posted

sry fabi who can get the jetpack over j

function giveJP()  
    if not doesPedHaveJetPack(g_Me) then 
        server.givePedJetPack(g_Me) 
        guiCheckBoxSetSelected(getControl(wndMain, 'jetpack'), true) 
    else 
        server.removePedJetPack(g_Me) 
        guiCheckBoxSetSelected(getControl(wndMain, 'jetpack'), false) 
    end 
end 
bindKey('j', 'down', giveJP) 

but it this script not work:

function ColShapeHit ( thePlayer, matchingDimension ) 
if isElementWithinColShape(source,g_base_col) == true then 
if ( doesPedHaveJetPack ( thePlayer ) ) then 
    removePedJetPack ( thePlayer ) 
end 
end 
end 
addEventHandler ( "onClientRender", ColShapeHit ) 

Posted
  
  
function hit ( pla, source ) 
    if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
                outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                            if ( doesPedHaveJetPack ( pla ) ) then 
                            removePedJetPack ( pla ) 
                outputChatBox ( "***Admin Area***", pla, 255, 0, 0 ) 
                outputChatBox ( "* "..getPlayerName(pla).." has entered the Admin Area!", g_root, 255, 0, 0 )    
                outputChatBox ( "* "..getPlayerName(pla).." please left the Admin Area!", pla, 255, 0, 0 )   
end 
end 
        end 
    end 
addEventHandler ( "onColShapeHit", g_base_col, hit ) 
  
  
function ColShapeHit ( thePlayer, matchingDimension ) 
  if getElementType ( pla ) == "player" then 
if isElementWithinColShape(pla,g_base_col) == true then 
if ( doesPedHaveJetPack ( pla ) ) then 
    removePedJetPack ( pla ) 
end 
end 
end 
addEventHandler ( "onClientRender", ColShapeHit ) 
  

try it

My Projects!

No one.

Posted

it come an error message:

WARNING: test/ad_base_s.lua:51: Bad argument @ '

addEventHandler' [Expected element at argument 2, got function]

Posted
function hit ( pla ) 
    if (getElementType ( pla ) == "player") then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
            outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) 
        else 
            setElementData ( pla, "inRestrictedArea", "true" ) 
            triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
            if ( doesPedHaveJetPack ( pla ) ) then 
                removePedJetPack ( pla ) 
            end 
            outputChatBox ( "***Admin Area***", pla, 255, 0, 0 ) 
            outputChatBox ( "* "..getPlayerName(pla).." has entered the Admin Area!", g_root, 255, 0, 0 )   
            outputChatBox ( "* "..getPlayerName(pla).." please leave the Admin Area!", pla, 255, 0, 0 )   
        end 
    end 
end 
addEventHandler ( "onColShapeHit", g_base_col, hit ) 

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

No one can come and get the jetpack

and it just happens nothing:

  
function ColShapeHit ( thePlayer, matchingDimension ) 
  if getElementType ( pla ) == "player" then 
if isElementWithinColShape(pla,g_base_col) == true then 
if ( doesPedHaveJetPack ( pla ) ) then 
    removePedJetPack ( pla ) 
end 
end 
end 
addEventHandler ( "onClientRender", g_base_col , ColShapeHit ) 

the other works

Posted

@GanJaRuleZ: Your script is a total mess, would help if you stop replying, it'll confuse the topic creator.

@Zokan: You want to give a jetpack if he player is admin? and if not, remove it?

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