Jump to content

Error Script


Recommended Posts

Posted

This is the Error

[2012-07-14 13:34:46] SCRIPT ERROR: factions\SFPD.lua:16: function arguments expected near 'if' 
[2012-07-14 13:34:46] WARNING: Loading script failed: factions\SFPD.lua:16: function arguments expected near 'if' 

The code of the Script

gates = {} 
cols = {} 
  
gates[1] = createObject(1495, 239.5, 116.099609375, 1002.200012207, 0, 0, 90) 
  
gates[2] = createObject(1495, 239.5, 119.099609375, 1002.200012207, 0, 0, 270) 
  
cols[1] = createColCircle ( 239.5, 116.099609375, 1002.200012207, 2 ) 
setElementInterior ( gate[1], 10) 
setElementInterior ( gate[2], 10) 
setElementInterior ( cols[1], 10) 
  
function moveGate(thePlayer) 
if source == cols[1] then 
    isPlayerInFaction = exports.factions:isPlayerInFaction  
    if isPlayerInFaction(source, 1) then 
        moveObject (gates[1], 2000, 253.19921875, 107.599609375, 1002.200012207 ) 
        moveObject (gates[2], 2000, 253.19921875, 110.599609375, 1002.200012207 ) 
          end 
     end 
end 
addEventHandler( "onColShapeHit", getRootElement(), openGates ) 
  
function closeGates(thePlayer) 
if source == cols[1] then 
    isPlayerInFaction = exports.factions:isPlayerInFaction  
    if isPlayerInFaction(source, 1) then 
       moveObject (gates[1], 5000, 239.5, 116.099609375, 1002.200012207 ) 
       moveObject (gates[2], 5000, 239.5, 119.099609375, 1002.200012207 ) 
          end 
     end 
end 
addEventHandler( "onColShapeLeave", getRootElement(), closeGates ) 

HELP! :S

Posted
gates = { } 
cols = { } 
  
gates [ 1 ] = createObject(1495, 239.5, 116.099609375, 1002.200012207, 0, 0, 90) 
  
gates [ 2 ] = createObject(1495, 239.5, 119.099609375, 1002.200012207, 0, 0, 270) 
  
cols [ 1 ] = createColCircle ( 239.5, 116.099609375, 1002.200012207, 2 ) 
setElementInterior ( gates [ 1 ], 10 ) 
setElementInterior ( gates [ 2 ], 10 ) 
setElementInterior ( cols [ 1 ], 10 ) 
  
function moveGate ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( thePlayer, 1 ) then 
            moveObject ( gates [ 1 ], 2000, 253.19921875, 107.599609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 2000, 253.19921875, 110.599609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", getRootElement(), openGates ) 
  
function closeGates ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( thePlayer, 1 ) then 
            moveObject ( gates [ 1 ], 5000, 239.5, 116.099609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 5000, 239.5, 119.099609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", getRootElement(), closeGates ) 

Your problem was with this line:

isPlayerInFaction = exports.factions:isPlayerInFaction 

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
gates = {} 
cols = {} 
  
gates[1] = createObject(1495, 239.5, 116.099609375, 1002.200012207, 0, 0, 90) 
  
gates[2] = createObject(1495, 239.5, 119.099609375, 1002.200012207, 0, 0, 270) 
  
cols[1] = createColCircle ( 239.5, 116.099609375, 1002.200012207, 2 ) 
setElementInterior ( gates[1], 10) --forgot the 's' 
setElementInterior ( gates[2], 10) -- forgot the 's' 
setElementInterior ( cols[1], 10) 
  
function moveGate ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( source, 1 ) then 
            moveObject ( gates [ 1 ], 2000, 253.19921875, 107.599609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 2000, 253.19921875, 110.599609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", getRootElement(), openGates ) 
  
function closeGates ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( source, 1 ) then 
            moveObject ( gates [ 1 ], 5000, 239.5, 116.099609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 5000, 239.5, 119.099609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", getRootElement(), closeGates ) 

Posted
Thanks!!! :D but this is the error now D:

ERROR: factions\SFPD.lua:9: attempt to index global 'gate' (a nil value) 

Copy my code again.

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

Thanks but now I can not open the door when I'm around. Here is the complete script and I do not skip any errors but still does not work.

gates = {} 
cols = {} 
  
gates[1] = createObject(1495, 239.5, 116.099609375, 1002.200012207, 0, 0, 90) 
  
gates[2] = createObject(1495, 239.5, 119.099609375, 1002.200012207, 0, 0, 270) 
  
cols[1] = createColCircle ( 239.5, 116.099609375, 1002.200012207, 2 ) 
setElementInterior ( gates[1], 10)  
setElementInterior ( gates[2], 10) 
setElementInterior ( cols[1], 10) 
  
function moveGate ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( source, 1 ) then 
            moveObject ( gates [ 1 ], 2000, 253.19921875, 107.599609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 2000, 253.19921875, 110.599609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", getRootElement(), openGates ) 
  
function closeGates ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( source, 1 ) then 
            moveObject ( gates [ 1 ], 5000, 239.5, 116.099609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 5000, 239.5, 119.099609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", getRootElement(), closeGates ) 

Here the Meta.XML

  

    

I use the gamemode Paradise

Posted

Oh, I found the problem, copy my code again.

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

Does it output script errors? what exactly does not work?

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

I think that I found the error

gates = { } 
cols = { } 
  
gates [ 1 ] = createObject(1495, 239.5, 116.099609375, 1002.200012207, 0, 0, 90) 
  
gates [ 2 ] = createObject(1495, 239.5, 119.099609375, 1002.200012207, 0, 0, 270) 
  
cols [ 1 ] = createColCircle ( 239.5, 116.099609375, 1002.200012207, 2 ) 
setElementInterior ( gates [ 1 ], 10 ) 
setElementInterior ( gates [ 2 ], 10 ) 
setElementInterior ( cols [ 1 ], 10 ) 
  
function moveGate ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( thePlayer, 1 ) then 
            moveObject ( gates [ 1 ], 2000, 253.19921875, 107.599609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 2000, 253.19921875, 110.599609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", getRootElement(), moveGate ) 
  
function closeGates ( thePlayer ) 
    if ( source == cols [ 1 ] ) then 
        if exports.factions:isPlayerInFaction ( thePlayer, 1 ) then 
            moveObject ( gates [ 1 ], 5000, 239.5, 116.099609375, 1002.200012207 ) 
            moveObject ( gates [ 2 ], 5000, 239.5, 119.099609375, 1002.200012207 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", getRootElement(), closeGates ) 

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