Jump to content

[HELP] Bad argument in a script


Recommended Posts

Hello everyone,

Can someone help me with this problem, this is the line in my server.Lua resource called tr-lobby:

local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0;

And when I start the server, I get this error:
ERROR: tr-lobby\server.Lua:246: bad argument #1 to 'sub' (string expected, got boolean)

If anyone can tell me how the code should look like, because I am not really a good scripter. Alse to mention that when I restart the resource two times, I don't get the error anymore.

Thanks in advance!

Link to comment

Hello pbradjan1994,

did you know that a period (".") cannot be put into name of settings? It says so in the documentation: https://wiki.multitheftauto.com/wiki/Get

I recommend changing the period for a dash ("-") so that the error could get fixed ;)
Remember to also change this for any call of set aswell.

Since I do not have access to all relevant portions of your script I cannot know what further errors would be inside. Feel free to ask more questions with further details.

Edited by The_GTA
Link to comment

Thanks a lot for your help, I tried to put a dash, but then I got some other error, but never mind, that line of code is just for setting the time, but since I am setting the time in every map, I don't really need this line ? so I removed it, and everything is working fine now.

But I have another question, do you know what is a requestLODsClient event? I can't find any information about it.

I get this error sometimes:
ERROR: Client triggered serverside event requestLODsClient, but event is not added serverside

It's not my script, I downloaded it and I am trying to make it work. It does work actually, but sometimes I get these errors in the console, which do not affect the game, but I would like to fix them if possible. ?

Link to comment
30 minutes ago, pbradjan1994 said:

I get this error sometimes:

ERROR: Client triggered serverside event requestLODsClient, but event is not added serverside

It's not my script, I downloaded it and I am trying to make it work. It does work actually, but sometimes I get these errors in the console, which do not affect the game, but I would like to fix them if possible. ?

If it is not inside of your script it looks like a custom event inside of a map system resource. I don't think it is inside any of the standard MTA server resource. What other resources do you have running on your server? Do any of the resources look like map resources with custom scripts?

Link to comment

It's not inside of the scripts, so you might be right, it could be a custom event somewhere, I'll take a look. Thanks a lot!

Can you help me with one more thing, and I won't bother you anymore, I promise ?

Is there any script, actually a resource, that can enable collisions for all vehicles in all maps. Because I tried everything, and I just can't find where to change that in this resource, that is actually a multi gamemode, so if I can somehow override that with another resource?

And can you recommend me, a good script for private message system, that uses the format /pm id, instead of /pm nick, and output in the chatbox whom I sent the message and what I wrote, and of course, when I receive a message, who is the sender, and the message itself. I need to find that, and a resource that will show players a chat balloon when someone is typing, not the actual message, just a chat balloon on top of the player, so that other players know when someone is typing. I found some, but they are not good at all.

That is what I need to find, and I am pretty much done with the server! So I would appreciate if you could send me some good resources. And again, thanks for the help so far!

Link to comment
55 minutes ago, pbradjan1994 said:

Is there any script, actually a resource, that can enable collisions for all vehicles in all maps. Because I tried everything, and I just can't find where to change that in this resource, that is actually a multi gamemode, so if I can somehow override that with another resource?

Because there is no MTA event for enabling ghost modes on vehicles you cannot easily disable it by script. What you could do though is disable the right to use functions through ACl.xml. Typically the functions setElementCollidableWith and setElementCollisionsEnabled are used to disable collisions. If you disable these functions for every other resource you could prevent ghost mode activation, the lazy way :P 

1 hour ago, pbradjan1994 said:

And can you recommend me, a good script for private message system, that uses the format /pm id, instead of /pm nick, and output in the chatbox whom I sent the message and what I wrote, and of course, when I receive a message, who is the sender, and the message itself. I need to find that, and a resource that will show players a chat balloon when someone is typing, not the actual message, just a chat balloon on top of the player, so that other players know when someone is typing. I found some, but they are not good at all.

I spent some time looking around MTA community resources and could find no such PM system that works by "ID". This is because the MTA API does not work with IDs. I am pretty sure that you can easily create such a system yourself. Especially if you are talking about chat bubbles you can use the function getScreenFromWorldPosition to easily find where to display your chat bubble.

Hope that I could help!

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