C
C#16mo ago
TerraReturns

❔ FRUSTRATION

I'm having the worst time trying to figure out why I'm getting a Error while compiling: IslandPatrol.cs(126,12): error CS1525: Unexpected symbol `void' error. I've looked on the lines specifically, and I can't exaclty diagnose the problem and it's driving me insane I'll provide some code that comes a little before and a little after
25 Replies
TerraReturns
TerraReturnsOP16mo ago
I think it has something to do with the start event logic but i'm not sure
SinFluxx
SinFluxx16mo ago
Try and include the line numbers in your screenshots so people can see where line 126 is
TerraReturns
TerraReturnsOP16mo ago
oh yes sorry about that
TerraReturns
TerraReturnsOP16mo ago
there you go
SinFluxx
SinFluxx16mo ago
The first thing that jumps out at me is you have two LoadConfigValues methods
Tvde1
Tvde116mo ago
that's a problem too. Also you have a } at line 100 and at 102, so probably defining methods outside of a class
TerraReturns
TerraReturnsOP16mo ago
still getting errors after fixing both of those issues
TerraReturns
TerraReturnsOP16mo ago
i commented out the lower loadconfigvalues method as well and it still didnt work
SinFluxx
SinFluxx16mo ago
Are you able to $paste the full class and provide the full error message?
MODiX
MODiX16mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
TerraReturns
TerraReturnsOP16mo ago
sure, give me a second
SinFluxx
SinFluxx16mo ago
It looks like it's what Tvde said, your cmdForceEvent method onwards are sat outside of your IslandPatrol class
TerraReturns
TerraReturnsOP16mo ago
oh is it really shit i didnt even notice lol i moved it back up to
public class IslandPatrol : RustPlugin
{

[ConsoleCommand("forceevent")]
void cmdForceEvent(ConsoleSystem.Arg arg)
{
var player = arg.Player();
if (player != null && !player.IsAdmin) return;
StartEvent();


arg.ReplyWith("Island Patrol event has been forced to start!");
}
public class IslandPatrol : RustPlugin
{

[ConsoleCommand("forceevent")]
void cmdForceEvent(ConsoleSystem.Arg arg)
{
var player = arg.Player();
if (player != null && !player.IsAdmin) return;
StartEvent();


arg.ReplyWith("Island Patrol event has been forced to start!");
}
but it still gives the same error unless i did it wrong
SinFluxx
SinFluxx16mo ago
Did you move all the methods below it as well?
TerraReturns
TerraReturnsOP16mo ago
No, i only moved
[ConsoleCommand("forceevent")]
void cmdForceEvent(ConsoleSystem.Arg arg)
{
var player = arg.Player();
if (player != null && !player.IsAdmin) return;
StartEvent();


arg.ReplyWith("Island Patrol event has been forced to start!");
}
[ConsoleCommand("forceevent")]
void cmdForceEvent(ConsoleSystem.Arg arg)
{
var player = arg.Player();
if (player != null && !player.IsAdmin) return;
StartEvent();


arg.ReplyWith("Island Patrol event has been forced to start!");
}
SinFluxx
SinFluxx16mo ago
All methods need to be in a class
TerraReturns
TerraReturnsOP16mo ago
well i put the method within the IslandPatrol class and [ConsoleCommand flashes green for a second and then goes back to blue which probably means it out of the class but i cant figure out how to keep it in IslandPatrol All i need to do is put it within the } right?
SinFluxx
SinFluxx16mo ago
Yes, just make sure all the methods are within the {} of the class
TerraReturns
TerraReturnsOP16mo ago
it shows it inside of IslandPatrol
TerraReturns
TerraReturnsOP16mo ago
but i still get this error Error while compiling: IslandPatrol.cs(133,12): error CS1525: Unexpected symbol 'void
SinFluxx
SinFluxx16mo ago
Make sure ALL the methods in that file are inside it, not just that one
TerraReturns
TerraReturnsOP16mo ago
ok gimme a second yeah i moved all my methods in the IslandPatrol class and it works perfectly thanks i was so confused because all the methods were correct so it has been pretty frustrating for the past 3-4 hours
SinFluxx
SinFluxx16mo ago
Can understand the annoyance, one of those things you shouldn't forget now at least!
TerraReturns
TerraReturnsOP16mo ago
but thanks for being a helping hand i'll make sure to keep this in mind oh yeah cant forget this
Accord
Accord16mo ago
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.
Want results from more Discord servers?
Add your server