Jump to content

Problem witch spawnPlayer(source, 0, 0, 0)


Recommended Posts

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

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

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