View Issue Details

IDProjectCategoryView StatusLast Update
0006216Multi Theft Auto : San AndreasServerpublic2013-02-03 11:42
Reportergrinchfox Assigned ToKenix  
Status resolvedResolutionfixed 
Target Version1.3.2Fixed in Version1.3.2 
Summary0006216: Add "shared" script type in meta.xml

Could you add "shared" script type in meta.xml plz
Would be more comfortable to define shared scripts by one line instead of two lines with server and client definitions of a single lua file.
Plz dont blame me in my noobity if that already exist, I just did not found that in MTA's meta.xml wiki page.


<script src="definitions.lua" type="shared">

insted of 

<script src="definitions.lua" type="client">
<script src="definitions.lua" type="server">
TagsNo tags attached.


has duplicate 0007486 closed Multi Theft Auto : San Andreas Type shared for the script tag in meta.xml 
related to 0007491 resolvedKenix Source patches Patch for #0006216: Add "shared" script type in meta.xml 



2011-06-29 18:13

reporter   ~~0013845

How do you want a server+clientside script to be exactly the same?


2011-06-29 18:26

viewer   ~~0013846

Shared scripts are useful for definitions of names, properties and other data stuff, also for some shared functions of spawning or debugging that I have in my scripts.

p.s. dont blame cuz I forgot to write slash at end of script definition blocks


2011-06-29 18:27

reporter   ~~0013847

xml files plox?


2011-06-29 21:25

reporter   ~~0013850

You mean variables? Client and Server differ from each other, so sharing variables would probably break a lot of stuff. You can use triggerClientEvent/triggerServerEvent to synchronize data (client <-> server).


2011-06-29 21:27

viewer   ~~0013851

And how many "shared" scripts do you using in your resources? If 10 or 20 - it is not a problem.


2011-06-29 21:32

administrator   ~~0013853

Hey, i also often have a definitions file which is both client and server side. Even though that's usually just one file per resource, it isn't hard to add a shared type. I might go for it, but it's low priority


2011-06-29 21:37

viewer   ~~0013855

Last edited: 2011-06-29 21:41

so why "shared"? may be "both", "general" or same


2011-06-30 10:51

viewer   ~~0013861

For example: this time im making building addon like in TF. It should show ghosted preview of your building on clientside and when you accept, it will build it on serverside. Then I need to define building's structure on both sides and keep it updated. So im just writing shared definition of that building.
icon="png/icon_fence.png", -- i know that is no needed on serverside but
-- its better to keep all in one table
id=1234, -- i dont remember specific value
} -- there could be more than one object

Also i have shared function for spawning objects from "model" table wich returns table of spawned objects so if I add some new property, it will be on both sides.
That why I need shared lua files.

Also would be good to add global bool vars CLIENT and SERVER in shared scripts wich indicated on what side that script runs. It could be useful for small exceptions in shared scripts.

MX_Master, I dont know why "shared" but it sounds better (for me) than "both" or "general" or it just my habbit from garry's mod.


2011-06-30 20:30

administrator   ~~0013867

CLIENT = not triggerClientEvent
SERVER = not triggerServerEvent

and if you want it on one line, how about:
<script src="definitions.lua" type="client"> <script src="definitions.lua" type="server">


2011-11-10 05:31

viewer   ~~0015216

This would be very useful just to be able to store small utility functions in one file, rather than have them in two separate files.


2011-11-10 15:40

viewer   ~~0015222

In dxscoreboard there is a shared script, that's an example.


2011-12-21 18:26

viewer   ~~0015458

but you don't have to put the file twice, you just need define it twice.
really no problem about this.


2011-12-21 18:34

manager   ~~0015459

This sounds like an absolute waste of developers time to me.

Just have the file twice?


2013-02-02 10:31

updater   ~~0018096

Issue History

Date Modified Username Field Change