JustDance Posted May 24, 2010 Share Posted May 24, 2010 Help me pls. I cant use spawnPlayer function. It not work. In console write: [12:07:31] WARNING: login_server.lua: Bad 'player' pointer @ 'spawnPlayer'(1) - Line: 72 I use: function serverRegister(newUsername, newPassword, newMail) local newXML = xmlCreateFile ( ":RPGRACE_login/accounts/" .. newUsername .. ".xml", "account" ) local usernameNode = xmlCreateSubNode ( newXML, "username" ) xmlNodeSetValue ( usernameNode, newUsername ) local passwordNode = xmlCreateSubNode ( newXML, "password" ) xmlNodeSetValue ( passwordNode, newPassword ) local adminNode = xmlCreateSubNode ( newXML, "admin" ) xmlNodeSetValue ( adminNode, "0" ) local mailNode = xmlCreateSubNode ( newXML, "mail" ) xmlNodeSetValue ( mailNode, newMail ) local statNode = xmlCreateSubNode ( newXML, "stat" ) local lvlNode = xmlCreateSubNode ( statNode, "lvl" ) xmlNodeSetValue ( lvlNode, "1" ) local moneyNode = xmlCreateSubNode ( statNode, "money" ) xmlNodeSetValue ( moneyNode, "0" ) local winsNode = xmlCreateSubNode ( statNode, "wins" ) xmlNodeSetValue ( winsNode, "0" ) local racesNode = xmlCreateSubNode ( statNode, "races" ) xmlNodeSetValue ( racesNode, "0" ) local carNode = xmlCreateSubNode ( statNode, "car" ) xmlNodeSetValue ( carNode, "0" ) local carcolorNode = xmlCreateSubNode ( statNode, "carcolor" ) xmlNodeSetValue ( carcolorNode, "0" ) local scoresNode = xmlCreateSubNode ( statNode, "scores" ) xmlNodeSetValue ( scoresNode, "0" ) local rankNode = xmlCreateSubNode ( statNode, "rank" ) xmlNodeSetValue ( rankNode, "Newbie" ) xmlSaveFile( newXML ) spawnPlayer(source, 0,0 ,0) triggerClientEvent ( source, "clientRegister2", getRootElement() , newUsername, newPassword, newMail ) end addEvent("serverRegister", true) addEventHandler("serverRegister", getRootElement(), serverRegister) Link to comment
robhol Posted May 24, 2010 Share Posted May 24, 2010 "source" isn't a player. Watch how you trigger this event, make sure you trigger it for the player element and not the root element, etc. Link to comment
Gamesnert Posted May 24, 2010 Share Posted May 24, 2010 You haven't set the player as source. Use client instead. Muh, robhol beat me to it it seems. Link to comment
JustDance Posted May 24, 2010 Author Share Posted May 24, 2010 how variable my player to walk? How do I install the player as the source? Markups below to find out how variable player? Link to comment
Xeno Posted May 24, 2010 Share Posted May 24, 2010 Try this. function serverRegister(newUsername, newPassword, newMail, player) local newXML = xmlCreateFile ( ":RPGRACE_login/accounts/" .. newUsername .. ".xml", "account" ) local usernameNode = xmlCreateSubNode ( newXML, "username" ) xmlNodeSetValue ( usernameNode, newUsername ) local passwordNode = xmlCreateSubNode ( newXML, "password" ) xmlNodeSetValue ( passwordNode, newPassword ) local adminNode = xmlCreateSubNode ( newXML, "admin" ) xmlNodeSetValue ( adminNode, "0" ) local mailNode = xmlCreateSubNode ( newXML, "mail" ) xmlNodeSetValue ( mailNode, newMail ) local statNode = xmlCreateSubNode ( newXML, "stat" ) local lvlNode = xmlCreateSubNode ( statNode, "lvl" ) xmlNodeSetValue ( lvlNode, "1" ) local moneyNode = xmlCreateSubNode ( statNode, "money" ) xmlNodeSetValue ( moneyNode, "0" ) local winsNode = xmlCreateSubNode ( statNode, "wins" ) xmlNodeSetValue ( winsNode, "0" ) local racesNode = xmlCreateSubNode ( statNode, "races" ) xmlNodeSetValue ( racesNode, "0" ) local carNode = xmlCreateSubNode ( statNode, "car" ) xmlNodeSetValue ( carNode, "0" ) local carcolorNode = xmlCreateSubNode ( statNode, "carcolor" ) xmlNodeSetValue ( carcolorNode, "0" ) local scoresNode = xmlCreateSubNode ( statNode, "scores" ) xmlNodeSetValue ( scoresNode, "0" ) local rankNode = xmlCreateSubNode ( statNode, "rank" ) xmlNodeSetValue ( rankNode, "Newbie" ) xmlSaveFile( newXML ) spawnPlayer(player, 0,0 ,0) triggerClientEvent ( source, "clientRegister2", getRootElement() , newUsername, newPassword, newMail ) end addEvent("serverRegister", true) addEventHandler("serverRegister", getRootElement(), serverRegister) Link to comment
Jumba' Posted May 24, 2010 Share Posted May 24, 2010 Help me pls. I cant use spawnPlayer function. It not work. In console write:[12:07:31] WARNING: login_server.lua: Bad 'player' pointer @ 'spawnPlayer'(1) - Line: 72 Look, eh, on the client-side file make sure its triggered with the player as the source so it'd be triggerServerEvent ( "serverRegister", getLocalPlayer(), newUsername, newPassword, newMail ) It should work. Link to comment
JustDance Posted May 25, 2010 Author Share Posted May 25, 2010 Oh Lola ... Just had no source, needed a client ... thanks Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now