sconer Posted October 8, 2013 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 )
Al3grab Posted October 8, 2013 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 .. ING : [xXx]~Al3grab
sconer Posted October 8, 2013 Author 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.
فاّرس Posted October 8, 2013 Posted October 8, 2013 (edited) He mean remove ' resetMapInfo() ' from code. Edited October 8, 2013 by Guest Sha67 سابقاً
Al3grab Posted October 8, 2013 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 ? ING : [xXx]~Al3grab
sconer Posted October 9, 2013 Author 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.
Al3grab Posted October 9, 2013 Posted October 9, 2013 addEventHandler("onPlayerJoin", root, function() spawn(player) end ) player is not defined here , use source instead ING : [xXx]~Al3grab
TAPL Posted October 9, 2013 Posted October 9, 2013 Same here. addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, player) end )
sconer Posted October 9, 2013 Author Posted October 9, 2013 Same here. addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, player) end ) What?
Dealman Posted October 9, 2013 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 ) If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
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