Raised This Month: $ Target: $400
 0% 

My scripting doubts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
d3athkai
Junior Member
Join Date: Jul 2009
Old 12-27-2009 , 03:05   My scripting doubts
Reply With Quote #1

Thanks
__________________


Last edited by d3athkai; 06-18-2014 at 09:59.
d3athkai is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-27-2009 , 03:19   Re: My scripting doubts
Reply With Quote #2

1) #pragma semicolon 1 forces strict semicolon mode, about incudling something you don't use? I dunno

2) Not really, but it makes it easier, use #pragma semicolon 1 (see 1)

3) Action: functions have to return Plugin_Handled, Plugin_Continue, or Plugin_Stop.

4) uhhh dunno

5) probably, but its minimal.
Dragonshadow is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 12-27-2009 , 09:19   Re: My scripting doubts
Reply With Quote #3

1) Functions in include files are usually stock functions. They are not compiled if they aren't used in your code.

3) Functions tagged with Action requires some instructions on return telling it how to deal with events and actions (usually). Plugin_Handled is usually blocking the event/action and Plugin_Continue is ignoring it. Plugin_Stop is mostly used in timer callbacks to stop the timer, as far as I know.

4) In general all handles you create should be closed when done with it to prevent memory leaks. But on some stuff there are exceptions: http://wiki.alliedmods.net/Menu_API_...g_Menu_Handles

5) Less plugins do use less memory, but as Dragonshadow said, it's so small amounts you don't need to worry about that. Like a big plugin I work on, it's still just using 1-2 MB. On most other plugins you'll only save a few KB.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 12-27-2009 , 15:26   Re: My scripting doubts
Reply With Quote #4

4)

Code:
if (action == MenuAction_End)
	{
		/* This is called after VoteEnd */
		CloseHandle(menu);
	}
(In the handler callback) is the magic block of code. Every menu that disappears from the client's screen (or is replaced by another) calls the handler with 'action' set to MenuAction_End.

So this is the only spot you need to put a CloseHandle();

Closing the handle while in use can cause instability.
__________________
Greyscale 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 16:56.


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