Jump to content

Trying to learn. Stuck at a basic step-Black screen gamemode


Recommended Posts

Posted (edited)

THE ISSUE HAS BEEN RESOLVED

I rented a server to start learning, but I'm not sure what I'm doing. I'll try to explain and maybe somebody can point out the obvious.

The server is hosted by APEX. Mtaserver.conf (the lower part of the document that is setting resources) looks like this:

    <!-- Specifies resources that are loaded when the server starts and/or which are protected from being stopped. 
         To specify several resources, add more <resource> parameter(s). --> 
     
    <resource src="admin" startup="1" protected="0" /> 
    <resource src="defaultstats" startup="1" protected="0" /> 
    <resource src="helpmanager" startup="1" protected="0" /> 
    <resource src="joinquit" startup="1" protected="0" /> 
    <resource src="mapcycler" startup="1" protected="0" /> 
    <resource src="mapmanager" startup="1" protected="0" /> 
    <resource src="parachute" startup="1" protected="0" /> 
    <resource src="resourcebrowser" startup="1" protected="1" default="true" /> 
    <resource src="resourcemanager" startup="1" protected="1" /> 
    <resource src="scoreboard" startup="1" protected="0" /> 
    <resource src="spawnmanager" startup="1" protected="0" /> 
    <resource src="voice" startup="1" protected="0" /> 
    <resource src="votemanager" startup="1" protected="0" /> 
    <resource src="webadmin" startup="1" protected="0" /> 
     
    <!-- play is the default freeroam gamemode. Remove the following line to prevent it from starting. --> 
    <resource src="play" startup="1" protected="0" /> 
       
     
   
</config> 
  

The server works fine and I can play Freeroam. Apex servers set all this up.

O.K now I want to disable the gamemode freeroam (it sucks!) and follow the Scripting Introduction tutorial on the Wiki: https://wiki.multitheftauto.com/wiki/Sc ... troduction

So I went into the configuration file and removed:

And replaced it with:

I also created a folder, an .xml file and put my .lua script file through the online compiler (https://luac.multitheftauto.com/).

I tried changing the .xml file

The image shows that I did those things and the content of the .lua file before I put it into luac.multitheftauto.com. I'm just following the scripting introduction tutorial.

http://i.imgur.com/50fcaMG.jpg

The problem is that it shows a black screen when I connect to the server.

http://i.imgur.com/yJojfxp.jpg

I don't know what I should do now to make it work.

I have also tried to run the gamemode without putting it through the online compiler. It gives the same result.

I also tried adding another gamemode from the resources section of this website. It was a pirate wars mod. But that also gave me a black screen. So basically, I don't know much and I hope some will explain and help me out or else I'm stuck at this basic step, which is also embarrassing :D

Thanks.

Edited by Guest
Posted

The problem is that you've set your resource's name to [myserver]. By using square brackets, the system will be checking for resources under [myserver] and thus using it as a differentiaton directory.

You can see an example at [gamemodes], [gameplay] and so on.

So basically you'll need to rename your resource to myserver as specified on the wiki introduction.

To create your own resource, simply make a folder with your preferred name. We'll use "myserver" for this tutorial.

Now you should be under this directory:

server/mods/deathmatch/resources/myserver/

Posted (edited)
fadeCamera(source,true) 

It clearly explains on scripting introduction page that you need this, otherwise screen will be black.

If you look at his pictures this is what his script looks like:

local spawnX, spawnY, spawnZ = 1959.9, -1714.46, 10 
function joinHandler() 
spawnPlayer(source, spawnX, spawnY, spawnZ) 
fadeCamera(source, true) 
setCameraTarget(source, source) 
outputChatBox("Welcome to my server!", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 

It shows that he did put fadeCamera into his script. Maybe you should pay more attention ;).

Anyway, I'm basically a scripting newbie too, but I don't know if it'll cause problems that you have no spacing in your lines. Personally, i'd put the script like this:

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10 
function joinHandler() 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Welcome to My Server", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 

see how spawnPlayer is under function and the rest follow like that? I don't really know if not spacing it out will give you problems, but it could help.

Edited by Guest
Posted

That's called Indenting, maky55. And nope, not indenting won't cause problems in the script itself, but cause problems for you as it's a lot harder to see what's going on.

Posted

Maky then his example should work

He has to start the resource and reconnect

On the image he shown this code didnt execute nor it outputted text which means that he either didnt reconnect or the resource did not start (correctly)

Posted

I renamed the folder and removed the brackets. That worked like a charm!

http://i.imgur.com/Q0PQO6g.jpg

Thank you, Pee-Wee.

I should have been more careful. The tutorial did tell me the correct path to use, but for some reason I chose not to because I thought it would be more correct to use the brackets. I still don't understand fully what the brackets do, but I guess that's not important right now.

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