sconer Posted October 8, 2013 Share Posted October 8, 2013 Hello, i have a problem. When i connect to server there was a black screen. In my gamemode script i typed, to spawn player, but it don't spawn: local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() resetMapInfo() mysqlconnect() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function mysqlconnect() handler = mysql_connect("localhost", "root", "", "crpmta") -- Establish the connection if ( not handler ) then -- The connection failed outputDebugString("Unable to connect to the MySQL server") else mysql_close(handler) -- Close the connection end end function spawn(player) if not isElement(player) then return end playername = getPlayerName(player); outputChatBox("Sveiki atvykę" .. playername, player) spawnPlayer (player, 833.6880,-4476.9326,3.0984,90,0) setElementModel(player,72) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) end addEventHandler("onPlayerJoin", root, function() spawn(player) end ) addEventHandler("onPlayerQuit",root, function () if getPlayerCount() == 1 and get("spawnreset") == "onServerEmpty" then end end ) addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, player) end ) Link to comment
Al3grab Posted October 8, 2013 Share Posted October 8, 2013 local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() [size=8] [color=#FF0000]resetMapInfo()[/color] [/size] mysqlconnect() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) and please use [lua] tags .. Link to comment
sconer Posted October 8, 2013 Author Share Posted October 8, 2013 local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() [size=8] [color=#FF0000]resetMapInfo()[/color] [/size] mysqlconnect() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) and please use [lua] tags .. don't work. Link to comment
فاّرس Posted October 8, 2013 Share Posted October 8, 2013 (edited) He mean remove ' resetMapInfo() ' from code. Edited October 8, 2013 by Guest Link to comment
Al3grab Posted October 8, 2013 Share Posted October 8, 2013 local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() [size=8] [color=#FF0000]resetMapInfo()[/color] [/size] mysqlconnect() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) and please use [lua] tags .. don't work. what doesn't work ? Link to comment
sconer Posted October 9, 2013 Author Share Posted October 9, 2013 local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() [size=8] [color=#FF0000]resetMapInfo()[/color] [/size] mysqlconnect() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) and please use [lua] tags .. don't work. what doesn't work ? I removed it, but still when i connect there is a black screen. Link to comment
Al3grab Posted October 9, 2013 Share Posted October 9, 2013 addEventHandler("onPlayerJoin", root, function() spawn(player) end ) player is not defined here , use source instead Link to comment
TAPL Posted October 9, 2013 Share Posted October 9, 2013 Same here. addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, player) end ) Link to comment
sconer Posted October 9, 2013 Author Share Posted October 9, 2013 Same here. addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, player) end ) What? Link to comment
Dealman Posted October 9, 2013 Share Posted October 9, 2013 What? Player isn't being defined, therefore it does not know what to do. Replace player with source, source will be whatever element was just wasted. Where as player will return nil(I believe). addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, source) end ) 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