Raised This Month: $32 Target: $400
 8% 

Beginners help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lindgren
Member
Join Date: Jul 2007
Location: Sweden
Old 07-02-2007 , 10:54   Beginners help
Reply With Quote #1

Hi all,

The time has come when i want/need to toss out eventscript for good. But to do that i need to learn sourceMM scripting/coding and translate a few scripts.

So to learn i thought iīd start with a small easy script to learn the new way. However the first thing that happens is i run into trouble. I have searched forums, and read the wiki, i have also downloaded other scripts to see if i can find out that way but no. When an event happens i need to get the information about 1. Who are everyone connected, what team are they on and are they alive.
But i canīt for the life of me find out how to get that information, what funcions to call, is it at all possible without writing masses of lines of code to keep track of everyone joining and leaving myself?

So here i am asking kindly for a nice soul to help me learn and nudge me in the right direction.
Ps. I do have experience with java, c#, VB and Cobol so im not all together new
Lindgren is offline
Send a message via MSN to Lindgren
BAILOPAN
Join Date: Jan 2004
Old 07-02-2007 , 21:32   Re: Beginners help
Reply With Quote #2

if you're trying to do this with Metamod:Source, you must know the HL2SDK (that is true of Valve Server Plugins as well, but MM:S has the extra responsibility/feature of SourceHook usage).

To find when players connect/leave, it is best to hook IServerGameClients::ClientPutInServer/ClientDisconnect (hooked as post and pre respectively).

To find when events occur, simply use IGameEventManager2. It has builtin listening functionality and no hooking is needed.

Unfortunately you need to do all of that tracking yourself. MM:S is a very thin wrapper and does not try to provide intensive automation for all child plugins. It does this for optimization and so no one can claim it does unnecessary things.

If you want a much more simplified API, you can taken a look at SourceMod, either with plugins or C++ extensions, it often greatly simplifies the HL2SDK. It provides well documented functions with clear input/output guarantees, which HL2SDK does not. Of course, with this you lose the fine-tuned optimization control (i.e. SM has a lot more extra baggage than MM:S, comparatively speaking).
__________________
egg
BAILOPAN is offline
Lindgren
Member
Join Date: Jul 2007
Location: Sweden
Old 07-03-2007 , 03:35   Re: Beginners help
Reply With Quote #3

Thatīs no good news at all =/ I would probably do more harm then good trying to keep track of all the players like that, i guess im stuck with eventscripts then =( *sighs*
Lindgren is offline
Send a message via MSN to Lindgren
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 07-03-2007 , 11:13   Re: Beginners help
Reply With Quote #4

You can loop through the players and check their teams, steam IDs, etc. also. You don't need to keep track of everything on connect/disconnect.
L. Duke is offline
Lindgren
Member
Join Date: Jul 2007
Location: Sweden
Old 07-03-2007 , 19:04   Re: Beginners help
Reply With Quote #5

oh really? thatīs great news... Care to give me a hint codewise? canīt find any information about it anywhere and i have been searching the web a couple of days now.
Lindgren is offline
Send a message via MSN to Lindgren
BAILOPAN
Join Date: Jan 2004
Old 07-04-2007 , 00:25   Re: Beginners help
Reply With Quote #6

You need to keep track of whether players are in game or not. That's it. For a seasoned coder that is trivial; for someone unfamiliar with the HL2SDK or SourceHook, it is just a bit of research (and there are plenty of open source plugins with examples).

There is no reason to be "stuck with" EventScripts because even using an alternative like SourceMod is faster.

I don't see how that's not good news! You get multiple alternatives, all much faster with varying degrees of flexible complexity.
__________________
egg

Last edited by BAILOPAN; 07-04-2007 at 00:28.
BAILOPAN is offline
Lindgren
Member
Join Date: Jul 2007
Location: Sweden
Old 07-04-2007 , 08:35   Re: Beginners help
Reply With Quote #7

Your right, having lots of choices are a good thing. However iīm only using eventscripts for 2 short very simple scripts that i canīt be without. Obviously every extra plugin or mod running on the server adds risks for crashes, bugs, need updates and use resources so i do prefer if i could toss out eventscripts all together if i can, it feels like overkill to have it running for only 2 small scripts with less then 20 lines.
Iīm up for a challenge and do like learning new things, i just need a good place to start and thought iīd ask here if maybe someone knew a good plugin or examplecode i could look at or point me toward where i can find more information and if what i wanted to do was at all possible. I just need a leg to stand on and should be able to go on from there by myself hopefully.
As the topic suggests i am a beginner at this and want to learn.
Lindgren is offline
Send a message via MSN to Lindgren
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 07-04-2007 , 18:42   Re: Beginners help
Reply With Quote #8

Well can I personally give you one piece of advice before you start on your quest.

Try not to translate the ES scripts exactly how they're written, they use some strange conventions that you will probably need to forget as time passes
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Lindgren
Member
Join Date: Jul 2007
Location: Sweden
Old 07-05-2007 , 06:55   Re: Beginners help
Reply With Quote #9

Actualy i think i got all the info i need to write this plugin. Maybe iīll post if i need any help

Last edited by Lindgren; 07-05-2007 at 13:31.
Lindgren is offline
Send a message via MSN to Lindgren
Lindgren
Member
Join Date: Jul 2007
Location: Sweden
Old 07-05-2007 , 20:10   Re: Beginners help
Reply With Quote #10

Iīm currently trying to use CreateTimer(0.2, Delayed_action); with an extra parameter but keep getting the error message -> "error 100: function prototypes do not match" And om not sure what im doing wrong.
Quote:
CreateTimer(0.2, Delayed_action, value);

public Action:Delayed_action(Handle:timer, param1)
Lindgren is offline
Send a message via MSN to Lindgren
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 00:54.


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