Jump to content

Help needed LUA


jwalks

Recommended Posts

Posted
Editor      = {} 
Gate        = {} 
Gate2       = {} 
Precision   = {} 
status      = {} 
coll        = {} 
coll2        = {} 
coll3        = {} 
coll4        = {} 
  
 -- this script mod is (no longer) PRIVATE 
 -- - Deject3d 
  
function startBuilding(playerSource, commandName, objectid) 
    if not objectid then 
        outputChatBox("usage: /addgate objectid teamname", playerSource) 
        return false 
    end 
         
    local team = getTeamName(getPlayerTeam" class="kw2">getPlayerTeam(playerSource)) 
    if team then team = getTeamName(team) 
        else team = "" end 
    end 
    for i = 1,20 do 
        if Editor[i] == playerSource then 
            destroyElement(Gate[i]) 
            Gate[i] = null 
            Editor[i] = null 
            Precision[i] = null 
        end 
        if Editor[i] == null then 
            Editor[i] = playerSource -- set Editor[i] to who made the object 
  
                --creating object -v 
            local x,y,z = getElementPosition(playerSource) 
            object = createObject ( objectid, x + 3,y + 3,z) 
            interior = getElementInterior ( playerSource ) 
            setElementInterior(object,interior) 
                --created object -^ 
  
            Gate[i] = object -- added object identifier to the array, corresponds to who created it 
            Precision[i] = .5   -- default precision 
  
            bindKey(playerSource, "i",        "down", moveIt) 
            bindKey(playerSource, "j",        "down", moveIt) 
            bindKey(playerSource, "k",        "down", moveIt) 
            bindKey(playerSource, "l",        "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_up",   "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_down", "down", moveIt) 
            bindKey(playerSource, "pgup",         "down", moveIt) 
            bindKey(playerSource, "pgdn",         "down", moveIt) 
  
            bindKey(playerSource, "u",        "down", moveIt) 
            bindKey(playerSource, "o",        "down", moveIt) 
  
            bindKey(playerSource, "[",        "down", moveIt) 
            bindKey(playerSource, "]",        "down", moveIt) 
  
            bindKey(playerSource, "enter",        "down", nextPosition ,objectid, team) 
            bindKey(playerSource, "delete",       "down", removeIt, playerSource) 
  
            break -- done adding our object and who created it to the arrays... stop the loop 
        end 
    end 
  
end 
  

i get this error message

[18:57:32] SCRIPT ERROR: gatemaker\server.lua:66: '' expected near 'end'

[18:57:32] WARNING: Loading script failed: gatemaker\server.lua:66: '' expe

cted near 'end'

Posted
Editor      = {} 
Gate        = {} 
Gate2       = {} 
Precision   = {} 
status      = {} 
coll        = {} 
coll2        = {} 
coll3        = {} 
coll4        = {} 
  
 -- this script mod is (no longer) PRIVATE 
 -- - Deject3d 
  
function startBuilding(playerSource, commandName, objectid) 
    if not objectid then 
        outputChatBox("usage: /addgate objectid teamname", playerSource) 
        return false 
    end 
        
    local team = getTeamName(getPlayerTeam" class="kw2">getPlayerTeam(playerSource)) 
    if team then team = getTeamName(team) 
        else team = "" end 
    end 
    for i = 1,20 do 
        if Editor[i] == playerSource then 
            destroyElement(Gate[i]) 
            Gate[i] = null 
            Editor[i] = null 
            Precision[i] = null 
        end 
        if Editor[i] == null then 
            Editor[i] = playerSource -- set Editor[i] to who made the object 
  
                --creating object -v 
            local x,y,z = getElementPosition(playerSource) 
            object = createObject ( objectid, x + 3,y + 3,z) 
            interior = getElementInterior ( playerSource ) 
            setElementInterior(object,interior) 
                --created object -^ 
  
            Gate[i] = object -- added object identifier to the array, corresponds to who created it 
            Precision[i] = .5   -- default precision 
  
            bindKey(playerSource, "i",        "down", moveIt) 
            bindKey(playerSource, "j",        "down", moveIt) 
            bindKey(playerSource, "k",        "down", moveIt) 
            bindKey(playerSource, "l",        "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_up",   "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_down", "down", moveIt) 
            bindKey(playerSource, "pgup",         "down", moveIt) 
            bindKey(playerSource, "pgdn",         "down", moveIt) 
  
            bindKey(playerSource, "u",        "down", moveIt) 
            bindKey(playerSource, "o",        "down", moveIt) 
  
            bindKey(playerSource, "[",        "down", moveIt) 
            bindKey(playerSource, "]",        "down", moveIt) 
  
            bindKey(playerSource, "enter",        "down", nextPosition ,objectid, team) 
            bindKey(playerSource, "delete",       "down", removeIt, playerSource) 
  
            break -- done adding our object and who created it to the arrays... stop the loop 
        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

18:09:13] SCRIPT ERROR: gatemaker\server.lua:20: ')' expected near 'kw2'

[18:09:13] WARNING: Loading script failed: gatemaker\server.lua:20: ')' expected

near 'kw2'

this comes up wen i put it in

Posted

Editor      = {} 
Gate        = {} 
Gate2       = {} 
Precision   = {} 
status      = {} 
coll        = {} 
coll2        = {} 
coll3        = {} 
coll4        = {} 
  
 -- this script mod is (no longer) PRIVATE 
 -- - Deject3d 
  
function startBuilding(playerSource, commandName, objectid) 
    if not objectid then 
        outputChatBox("usage: /addgate objectid teamname", playerSource) 
        return false 
    end 
        
    local team = getTeamName(getPlayerTeam(playerSource)) 
    if team then team = getTeamName(team) 
        else team = "" end 
    end 
    for i = 1,20 do 
        if Editor[i] == playerSource then 
            destroyElement(Gate[i]) 
            Gate[i] = null 
            Editor[i] = null 
            Precision[i] = null 
        end 
        if Editor[i] == null then 
            Editor[i] = playerSource -- set Editor[i] to who made the object 
  
                --creating object -v 
            local x,y,z = getElementPosition(playerSource) 
            object = createObject ( objectid, x + 3,y + 3,z) 
            interior = getElementInterior ( playerSource ) 
            setElementInterior(object,interior) 
                --created object -^ 
  
            Gate[i] = object -- added object identifier to the array, corresponds to who created it 
            Precision[i] = .5   -- default precision 
  
            bindKey(playerSource, "i",        "down", moveIt) 
            bindKey(playerSource, "j",        "down", moveIt) 
            bindKey(playerSource, "k",        "down", moveIt) 
            bindKey(playerSource, "l",        "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_up",   "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_down", "down", moveIt) 
            bindKey(playerSource, "pgup",         "down", moveIt) 
            bindKey(playerSource, "pgdn",         "down", moveIt) 
  
            bindKey(playerSource, "u",        "down", moveIt) 
            bindKey(playerSource, "o",        "down", moveIt) 
  
            bindKey(playerSource, "[",        "down", moveIt) 
            bindKey(playerSource, "]",        "down", moveIt) 
  
            bindKey(playerSource, "enter",        "down", nextPosition ,objectid, team) 
            bindKey(playerSource, "delete",       "down", removeIt, playerSource) 
  
            break -- done adding our object and who created it to the arrays... stop the loop 
        end 
end 

P.S: I'm not using LUA tags because it would do the same ;)

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
Editor      = {} 
Gate        = {} 
Gate2       = {} 
Precision   = {} 
status      = {} 
coll        = {} 
coll2        = {} 
coll3        = {} 
coll4        = {} 
  
 -- this script mod is (no longer) PRIVATE 
 -- - Deject3d 
  
function startBuilding(playerSource, commandName, objectid) 
    if not objectid then 
        outputChatBox("usage: /addgate objectid teamname", playerSource) 
        return false 
    end 
         
    local team = getTeamName(getPlayerTeam(playerSource)) 
    if team then team = getTeamName(team) 
        else team = "" end 
    end 
    for i = 1,20 do 
        if Editor[i] == playerSource then 
            destroyElement(Gate[i]) 
            Gate[i] = null 
            Editor[i] = null 
            Precision[i] = null 
        end 
        if Editor[i] == null then 
            Editor[i] = playerSource -- set Editor[i] to who made the object 
  
                --creating object -v 
            local x,y,z = getElementPosition(playerSource) 
            object = createObject ( objectid, x + 3,y + 3,z) 
            interior = getElementInterior ( playerSource ) 
            setElementInterior(object,interior) 
                --created object -^ 
  
            Gate[i] = object -- added object identifier to the array, corresponds to who created it 
            Precision[i] = .5   -- default precision 
  
            bindKey(playerSource, "i",        "down", moveIt) 
            bindKey(playerSource, "j",        "down", moveIt) 
            bindKey(playerSource, "k",        "down", moveIt) 
            bindKey(playerSource, "l",        "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_up",   "down", moveIt) 
            bindKey(playerSource, "mouse_wheel_down", "down", moveIt) 
            bindKey(playerSource, "pgup",         "down", moveIt) 
            bindKey(playerSource, "pgdn",         "down", moveIt) 
  
            bindKey(playerSource, "u",        "down", moveIt) 
            bindKey(playerSource, "o",        "down", moveIt) 
  
            bindKey(playerSource, "[",        "down", moveIt) 
            bindKey(playerSource, "]",        "down", moveIt) 
  
            bindKey(playerSource, "enter",        "down", nextPosition ,objectid, team) 
            bindKey(playerSource, "delete",       "down", removeIt, playerSource) 
  
            break -- done adding our object and who created it to the arrays... stop the loop 
        end 
    end 
  
end 
  
function nextPosition(playerSource, key, keyState, objectid, team) 

Posted
-_-, just copy the last code i posted, that is fixed one.

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