Jump to content

Help me create mod


iPanda

Recommended Posts

My problem is - mod does not work.

I want to be a player comes to the server, when you press 1, he chooses the side of evil, or if you press 2, then the side of good. Each side spawns at two different points.

function spawnGood ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedGood ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
function spawnDead ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedDead ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
  
addEventHandler ( "onPlayerJoin", getRootElement (), 
    function ( ) 
        bindKey ( "1" "down", spawnGood ) 
        bindKey ( "2" "down", spawnDead ) 
    end 
) 
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( "1" "down", spawnGood ) 
            bindKey ( "2" "down", spawnDead ) 
        end 
    end 
) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedGood ) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedDead ) 
  

Link to comment

Now i hope it works.

Good luck 8)

function spawnGood ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedGood ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
function spawnDead ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedDead ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
  
addEventHandler ( "onPlayerJoin", getRootElement (), 
    function ( ) 
        bindKey ( "1", "down", spawnGood ) 
        bindKey ( "2", "down", spawnDead ) 
    end 
) 
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( "1", "down", spawnGood ) 
            bindKey ( "2", "down", spawnDead ) 
        end 
    end 
) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedGood ) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedDead ) 
  

Link to comment
Now i hope it works.

Good luck 8)

function spawnGood ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedGood ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
function spawnDead ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedDead ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
  
addEventHandler ( "onPlayerJoin", getRootElement (), 
    function ( ) 
        bindKey ( "1", "down", spawnGood ) 
        bindKey ( "2", "down", spawnDead ) 
    end 
) 
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( "1", "down", spawnGood ) 
            bindKey ( "2", "down", spawnDead ) 
        end 
    end 
) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedGood ) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedDead ) 
  

You have not changed anything. It still does not work

Link to comment

You forgot to define the player element at bindKey.

function spawnGood ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedGood ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
function spawnDead ( player ) 
    spawnPlayer ( player, posX, posY, posZ - 9, 0, 111, 0, 0, nil ) 
    giveWeapon ( player, 23, 100 ) 
    giveWeapon ( player, 8, 1 ) 
    giveWeapon ( player, 35, 1 ) 
end 
function wastedDead ( ) 
    spawnPlayer ( source, posX, posY, posZ - 9, 0, 121, 0, 0, nil ) 
    giveWeapon ( source, 23, 100 ) 
    giveWeapon ( source, 8, 1 ) 
    giveWeapon ( source, 35, 1 ) 
end 
  
addEventHandler ( "onPlayerJoin", getRootElement (), 
    function ( ) 
        bindKey ( source, "1" "down", spawnGood ) 
        bindKey ( source, "2" "down", spawnDead ) 
    end 
) 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( player, "1" "down", spawnGood ) 
            bindKey ( player, "2" "down", spawnDead ) 
        end 
    end 
) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedGood ) 
addEventHandler ( "onPlayerWasted", getRootElement (), wastedDead ) 

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