Jump to content

[SOLVED]Black screen with onResourceStart


Recommended Posts

It's maybe 'cause I am n00bish, but I'm learning.

function OnResourceStart()
createVehicle(562, 2035.3472, 1347.7974, 10.8203)
end
addEventHandler("onResourceStart", getRootElement(), OnResourceStart()
 
function OnPlayerJoin()
local x = 2035.3472
local y = 1346.7974
local z = 10.8203
spawnPlayer(source, x, y, z)
fadeCamera(source, true)
setCameraTarget(source, source)
outputChatBox("Test!", source)
end
addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin()

When I connect to server, the screen is black.

EDIT:

Sorry for bad category :oops:

Please move to Scripting.

EDIT2:

:redhotevil:

function OnResourceStart(res)
createVehicle(562, 2035.3472, 1347.7974, 10.8203)
end
addEventHandler("onResourceStart", getRootElement(), OnResourceStart)
 
function OnPlayerJoin()
local x = 2035.3472
local y = 1346.7974
local z = 10.8203
spawnPlayer(source, x, y, z)
fadeCamera(source, true)
setCameraTarget(source, source)
outputChatBox("Siema!", source)
end
addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin)

Maybe it's too hard for me?

Please close or remove this topic.

Edited by Guest
Link to comment

Why is your problem located at onResourceStart? I think you mean onPlayerJoin..

Does the function get called? Test this first.

Is the script serverside?

Do you get errors in the log file?

Apart from that, you should attach the onResourceStart event to the resource's root element, it is in, otherwise the car will be created with every script file, you load onto the server.

Link to comment

Maybe I badly written it. Problem is solved:

function OnResourceStart(res)
createVehicle(562, 2035.3472, 1347.7974, 10.8203)
end
addEventHandler("onResourceStart", getRootElement(), OnResourceStart)
 
function OnPlayerJoin()
local x = 2035.3472
local y = 1346.7974
local z = 10.8203
spawnPlayer(source, x, y, z)
fadeCamera(source, true)
setCameraTarget(source, source)
outputChatBox("Siema!", source)
end
addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin)

Link to comment

Although it is solved, I want to emphasize the following again:

Apart from that, you should attach the onResourceStart event to the resource's root element, it is in, otherwise the car will be created with every script file, you load onto the server.

If you don't fix that, you'll soon have 10 cars standing at one point.

Link to comment

Sorry, I'm just somehow pensive.

function OnResourceStart(res)
 
if(res == getThisResource())
then
createVehicle(562, 2035.3472, 1347.7974, 10.8203)
end
end
addEventHandler("onResourceStart", getRootElement(), OnResourceStart)

and close.

EDIT:

@DOWN: thanks.

Edited by Guest
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...