Jump to content

2 question


Zokan

Recommended Posts

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

Link to comment

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) 

Link to comment

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`

Link to comment
  
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

Link to comment

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 ) 

Link to comment

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 ) 

Link to comment
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

Link to comment
  
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
Link to comment
  
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

Link to comment

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 ) 

Link to comment
  
  
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

Link to comment
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 ) 

Link to comment

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

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