AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [HELP] Plugin Failing to Compile Without Errors (https://forums.alliedmods.net/showthread.php?t=308291)

Wanderlost 06-14-2018 14:54

[HELP] Plugin Failing to Compile Without Errors
 
Hi there!

I'm working on a plugin at the moment and I've been familiarizing myself well as I can with Sourcemod/Sourcepawn. I've just tried to add a rather complicated feature to my plugin that handles an array, uses multiple loops, and uses a ton of conditionals. I thought I did everything right, but when I went to compile, it did this:

https://i.imgur.com/FcKUWqt.png

The local compiler threw this error:

https://i.imgur.com/WBMwZN6.png

Here's the block of code I've added since the last time I compiled successfully. It's for a half-satirical Sonic gamemode that handles 7 "Chaos Emeralds" that change hands when somebody gets a kill, which handles 2 global variables called steEmeralds[7], which is supposed to be an array of 7 integers (one for each emerald), and steEmScatter, which is an integer used to handle the number of "Chaos Emeralds" that are not currently "held."
Spoiler


Edit: Oh! I should clarify, steMode is called on the player_spawn event, and steMode2 is called on the player_death event.

Any help or suggestions that could get this to compile correctly would be appreciated.
Thank you.

Fyren 06-14-2018 22:27

Re: [HELP] Plugin Failing to Compile Without Errors
 
It's hard to say since you don't provide the full source, but there's probably at least a bug in the compiler. The end result is it stops instead of reporting any of the errors in your code.

I think this is the problem that trips up the compiler: for {int steNum5 = 0; steNum5 <= 6; steNum5++)

You have an open brace instead of open parenthesis.

There are multiple other mistakes.
  • steEmeralds[] = {0, 0, 0, 0, 0, 0, 0}; should not have brackets, assuming steEmeralds is something like int steEmeralds[7].
  • You can't use FindValueInArray on a basic array, only ArrayLists.
  • else if (steEmNum > 1) should probably be steEmNum1 (or 2).
  • PrintToChatAll("%s stole %i Chaos Emeralds from %s!", steKillName, steEmNum2, steVicName"); has an extra closing double quote. The condition it's inside is the bullet immediately previous, so make sure you're printing the right number as well.
  • int steEmNum3 = steEmNum 1 + steEmNum2; should probably be steNum1.
  • int steNextVictim = steEmeralds[steNum4]; should probably have steNextVictim declared above in a higher scope.
  • Some of your strings don't seem to be declared. They're probably missing since it doesn't make much sense to declare them elsewhere.

Wanderlost 06-15-2018 00:52

Re: [HELP] Plugin Failing to Compile Without Errors
 
Wow! Thanks for that. I guess I was sloppier writing this than I thought. I'll use these notes to revise my code and let you know if this fixes it. I appreciate the help.

Wanderlost 06-16-2018 10:42

Re: [HELP] Plugin Failing to Compile Without Errors
 
Yeah, reviewing the code with these notes got me to a place where I was able to operate the compiler properly and got it to function. Unfortunately, the gamemode was fundamentally flawed for team death match, but I still appreciate the help, and I archived the functioning code for potential later use.

That being said, you did me a big favor. Thank you again.


All times are GMT -4. The time now is 22:45.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.