Jump to content

spawning as CJ bug


Wisin

Recommended Posts

Posted

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) 

Posted

do not bump your post. give us more than freaking 2 hours to reply :/

error says all:

  
player = xmlFindChild(xmlFile, "skin", playerSkin-1) 
  

this is returning false

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
do not bump your post. give us more than freaking 2 hours to reply :/

error says all:

  
player = xmlFindChild(xmlFile, "skin", playerSkin-1) 
  

this is returning false

yeah but why if some times works fine?

Posted

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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