Jump to content

Some help with my server


lalucidaniel

Recommended Posts

Ok so I read mta scripting wiki

Explain this a bit more for me:

Second example - A gamemode

/counterstrike

/meta.xml

/counterstrike.lua

/buymenu.lua

The counterstrike.lua contains similiar to the following features:

Let players choose their team and spawn them

Provide them with weapons, targets and instructions (maybe read from a Map, see below)

Define the game's rules, e.g. when does the round end, what happens when a player dies

.. and maybe some more

The buymenu.lua is a clientside script and creates a menu to buy weapons

This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The type attribute indicates that this example works with the Map manager, yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.

This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.

So I create a Counterstrike.lua (as example , mine is named different) for this script

/counterstrike

/meta.xml

/counterstrike.lua

/buymenu.lua

then where do I place this one?

And what to place in buymenu.lua ( I mean what commands)

Link to comment

in script.lua you type stuff like

  
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) 

aight? so the actual LUA statements that determine what goes on in your server

then theres a difference between server and client side scripts though: note that buymenu.lua has type="client" (see below)

most of your code will go server side, but some features such as GUIs (clickable menus), drawing things on screen, playing music, handling peds and so on go in clientside scripts

<script src="counterstrike.lua" /> 
<script src="buymenu.lua" type="client" /> 
  

This list:

/counterstrike

/meta.xml

/counterstrike.lua

/buymenu.lua

it's just the file structure inside your resource, you don't have to put that list anywhere.

However in the meta.xml file you define what files are related to your script. Mainly for those .lua scripts, but also for downloading images for display onscreen to clients or downloading mods for your players to use. Check out "Meta.xml" on the wiki for in-depth information.

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