❔ hook errors and unexpected }
So I’m working on some code for rust as of now and it’s function so far is to spawn a crate at a players position with a offset of 1.5 for the x, I keep getting errors with it though and I can’t seem to fix the issue anyone got a solution? Code:
40 Replies
What line has the error?
didn’t specify, my RCON only gave me an error when compiling saying it’s got a hook error
Code seems fine
Maybe it's tripping up at the interpolated string?
Possible
i wouldn’t really know, not very good at C# just yet
What could I do to fix the string issue if that is what it is?
string.Format
I’ll test it out, which line would it be?
Replacing the $"" strings
string.Format("Hello, my name is {0}", name)
for example
The number is the index of the parameter, you can have as many as you wantI see
Though I never heard of RCON
Haha RCON is a CMD basically
It’s for rust
rust uses C# plugins running under the mod manager oxidemod
many other games use it too, minecraft is a good example of one
Remote Console I see
Yes
So it has its own compiler to make sure it can run alongside the game?
Then maybe it's just outdated and doesn't support string interpolation, but then it would be tripping up on the $ before the string
Yes
and that’s pretty understandable
So what would I do for the $?
string.Format
Hm
Puts string.Format(“”); or Puts (string.Format “”);
latter
Format becomes the final string
?
Sorry I’m a little slow
Puts(string.Format())
Oh
New error
it’s calling a plugin I don’t have I think
Or exist
Nvm
What would I do for this
this.HookEvent(Rust.Event.OnEntityTakeDamage, OnEntityTakeDamage);
It's here
Does the base class have it??
base class?
I don’t follow
The CovalencePlugin class
probably not? I’m not 100% sure
Ctrl-click CovalencePlugin to check
Like a permission or something?
Inheritance in C#
Learn to use inheritance in C# libraries and applications.
Still don’t follow-
hackable derives from CovalencePlugin
For HookEvent to exist, it needs to be defined in hackable or its base class or somewhere higher on the hierarchy of classes
What could I add to the code which will make it exist then
Check the docs
which part
The page on HookEvent
Okay let me see here
New issue
Check the class definition
I’ll keep trying in a little
I have to do something for now
Alright I’m back
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.