Jump to content

Problem...


BumbiS*

Recommended Posts

Hah, i just start to script MTA, learning from wiki n' stuff, but when i edit a script, save it and start the server that edited script edits back to normal, like i translate ir from english to my language. Server starts, my translated line translates back to normal.. I edited original freeroam resource. Used Lua for windows.

Can someone can tell me how to do it right?

My english is not too good :?

Link to comment

probably you are editing client side files, downloaded to client on server connect.

You SHOULD edit this (path could be another for you):

C:\Program Files\MTA\server\mods\deathmatch\resources\freeroam

but you are probably modyfing this:

C:\Program Files\MTA\mods\deathmatch\resources\freeroam
Link to comment

You can unzip them and edit the files inside them. When you extract, make sure you extract it to a folder under the same name as the zip because MTA server first tries to load resource from a folder and ignores the zip with the same name.

Link to comment

and where can i make commands? In resources or Gamemode? I just created a command in fr_server, restart resource and command didn't worked. Or maybe i need it to make it in fr_client?

Command must work, i take it from wiki

function showLocalHealth()
-- get the player's health and output it
local playerHealth = getElementHealth ( getLocalPlayer() )
outputChatBox ( "Your health: " .. playerHealth )
 
-- get the player's vehicle: if he is in one, output its health as well
local playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() )
if playerVehicle then
local vehicleHealth = getElementHealth ( playerVehicle )
outputChatBox ( "Your vehicle's health: " .. vehicleHealth )
end
end
addCommandHandler ( "showhealth", showLocalHealth )

Link to comment

Commands can also be in non-gamemode resources, and a resource is not on a same level as a gamemode, so you can't say "resource or gamemode", because a resource can hold a gamemode.

The command, you provided, is for a clientside script, so yes, you have to put it into a clientside script file such as fr_client.lua .

In the wiki, it always says, whether examples are server- or clientside, if the page itself isn't already limited to server- or clientside scripting.

Link to comment
Commands can also be in non-gamemode resources, and a resource is not on a same level as a gamemode, so you can't say "resource or gamemode", because a resource can hold a gamemode.

The command, you provided, is for a clientside script, so yes, you have to put it into a clientside script file such as fr_client.lua .

In the wiki, it always says, whether examples are server- or clientside, if the page itself isn't already limited to server- or clientside scripting.

Why don't you explain to him why it's client-side? Saying "yes, you have to put it into a clientside script file such as fr_client.lua" doesn't teach him at all.

@BumbiS*

Log in as an admin and use "debugscript 3" command to see any errors in your script (server-side and client-side). Check your server console to see if you have any server-side errors (only if you don't use debug window - debugscript command - because it's wasting time to switch between console and game to see the same thing as you see in debug window). You would get an error because getLocalPlayer does not exist on server-side.

Link to comment
Why don't you explain to him why it's client-side?

Here you go:

The first thing to notice that is the getLocalPlayer(). This returns the player element of the machine, who is also running this script. And since there is no player on the serverside, it's a clear indication for a clientside script, where this function is very often used.

You can also notice that outputChatBox has no player parameter, which also leads to this conclusion. If you look at the serverside version of this function, you could also there leave out the player element, but that would result in every player seeing the message.

Hope, you're satisfied.

@Bumbi: You press F8 and then login using "login ".

If you did not already create an administrator account, have a look at this: https://wiki.multitheftauto.com/wiki/Ser ... nistrators

Link to comment
  • Discord Moderators
Thanks for helping, and i have a question. How to disable the original chat? I made a another chat with radius and when i type something it shows two lines, the one with radius and the other one without it( Original )

showChat

Probably use that in conjunction with onPlayerJoin to remove as soon as they join your server.

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