Jump to content

spawning as CJ bug


Wisin

Recommended Posts

hi, i got a big bug, i've made a game mode and works like this, you click on a city from a grid list then a team then select the skin and when click "Accept" button will setElementData of city team and skin and then i use onPlayerSpawn to spawn him but dunno why some times it spawns everyone as CJ and falling down at cords 0,0,1000. also outputs this errors,

bad argument @ 'xmlNodeGetAttributes' - Line: 32 attempt to index global 'playerAttributes' (a boolean value)

line 32 = playerAttributes = xmlNodeGetAttributes(player)

function playerSpawn() 
    local playerTeam = getElementData(source, "team") 
    local playerSkin = getElementData(source, "skin") 
    check(source) 
    local xmlFile = xmlLoadFile("Spawns.xml") 
        player = xmlFindChild(xmlFile, "skin", playerSkin-1) 
        playerAttributes = xmlNodeGetAttributes(player) 
        local positionX = playerAttributes.x 
        local positionY = playerAttributes.y 
        local positionZ = playerAttributes.z 
        setElementModel(source, playerAttributes.id) 
        setElementPosition(source, positionX, positionY, positionZ) 
        I = 0 
        while (xmlFindChild(player, "weapon", I)) do 
            local weapon = xmlFindChild(player, "weapon", I) 
            local weaponAttributes = xmlNodeGetAttributes(weapon) 
            giveWeapon(source, weaponAttributes.name, weaponAttributes.amount) 
            I = I + 1 
    end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), playerSpawn) 

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