Raised This Month: $51 Target: $400
 12% 

I am getting an error in my event plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Heypio
Junior Member
Join Date: Nov 2017
Old 01-05-2021 , 17:01   I am getting an error in my event plugin
Reply With Quote #1

I prepared an event plugin to play on my awp map, but when compiling I get the following errors. Where am I going wrong?

Code:
plugin.sp(88) : warning 217: loose indentation
plugin.sp(89) : warning 217: loose indentation
plugin.sp(102) : warning 217: loose indentation
plugin.sp(103) : warning 217: loose indentation
plugin.sp(105) : warning 217: loose indentation
Code size:             8284 bytes
Data size:             3436 bytes
Stack/heap size:      16384 bytes
Total requirements:   28104 bytes
Code:
nextRoundGravity = true; \\\\\\\\\\\\\\\\\\\ Line 88
PrintToChatAll("[Sourcemod] The next round gravity will be raised. Don't forget to buy the spacesuit."); \\\\\\\\\\\\\\\\\\\\ Line 89
nextRoundKnife = true; \\\\\\\\\ Line 102
PrintToChatAll("[Sourcemod] The next round one will be just the knife. Watch your back"); \\\\\\\\\\\ Line 103
else \\\\\\\\\\\\\\\\\\\\\\\\\\\\ Line 105

Code:
void EventVote()
{
	if (IsVoteInProgress())
	{
		return;
	}
	Menu menu = new Menu(Event_VoteMenu);
	menu.SetTitle("Event List");
	menu.AddItem("Gravity", "Gravity Round");
	menu.AddItem("deagle", "Deagle Round");
	menu.AddItem("knife", "Knife Event");
	menu.AddItem("noevent", "x NO EVENT x");
	menu.ExitButton = false;
	menu.DisplayVoteToAll(13);
}

public int Event_VoteMenu(Menu menu, MenuAction action, int client, int param1)
{
	if(action == MenuAction_End)
	{
		if(ResetTimer)
		{
			Timer_Event = CreateTimer(ConVar_TimeCFG.FloatValue, EventVoteStart, _, TIMER_FLAG_NO_MAPCHANGE);
			PrintToChatAll("[Sourcemod] It will be voted again after %d seconds.", ConVar_TimeCFG.IntValue);
		}
		delete menu;
	} 
	else 
        if(action == MenuAction_VoteEnd) 
	{
		char Item[32];
		menu.GetItem(param1, Item, sizeof(Item));
		if(StrEqual(Item, "Gravity")) 
		{
			delete Timer_Event;
		        nextRoundGravity = true;
			PrintToChatAll("[Sourcemod] The next round gravity will be raised. Don't forget to buy the spacesuit.");
		}
		else 
		if(StrEqual(Item, "deagle")) 
		{
			delete Timer_Event;
			nextRoundDeagle = true;
			PrintToChatAll("[Sourcemod] The next round will be the deagle tour. Prepare yourself");
		}
		else 
		if(StrEqual(Item, "knife")) 
		{
			delete Timer_Event;
		        nextRoundKnife = true;
			PrintToChatAll("[Sourcemod] The next round one will be just the knife. Watch your back");
	        }
	        else 
	        if(StrEqual(Item, "noevent")) 
	        {
			delete Timer_Event;
			ResetTimer = true;
			PrintToChatAll("[Sourcemod] Nobody wants activity. Continue the normal game!");
	        }
       }   
}

Last edited by Heypio; 01-05-2021 at 17:02.
Heypio is offline
TargetDummy
New Member
Join Date: Jan 2021
Old 01-05-2021 , 21:13   Re: I am getting an error in my event plugin
Reply With Quote #2

Hello,

First of all, those're not errors, only warnings.
More specifically they tell you, that you have bad indentantion; meaning, that your "spaces" before lines are "incorrect"

When I select your code (which you send) and paste it in my editor, I can see that:
line 35 has tabulator indent (you pressed tab, or your editor put it there)
line 36 has spaces (you pressed space to indent the line)
line 37 has tabulator once again.


The same goes for lines 49;50;51

Line 53 is indented through spaces (the else statement, the if before has tabulators).

I'll try to paste the code here (from my editor) so you can see the errors in indentation:

PHP Code:
        if(StrEqual(Item"Gravity")) 
        {
            
delete Timer_Event;
                
nextRoundGravity true;
            
PrintToChatAll("[Sourcemod] The next round gravity will be raised. Don't forget to buy the spacesuit.");
        } 
You can clearly see, that the nextRoundGravity is not indented same as the rest.

I hope this helps you. Have a good day
TargetDummy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:14.


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