Making a plugin tutorial?
I'm looking to make a plugin for L4D and L4D2 is there any tutorials on how to get started? I know entry level C++ I don't know if that's enough I'm kinda rusty XD
|
Re: Making a plugin tutorial?
Have fun: http://wiki.alliedmods.net/Category:SourceMod_Scripting
When you've done enough, look at other L4D(2) plugins to get an idea of some of the things you can do. |
Re: Making a plugin tutorial?
Thank you for the tutorials it seems my C++ knowledge will transfer a little. The tutorial is still a little confusing or im just really rusty. for exmaple in
public Action:Command_Slap(client, arges) are these two parameters or what? If so where are they getting them from because the next part gets the arguments which maybe I'm confused between those, but its looking for the username and the amount of damage which is 2 arguments, but it does this by checking the parameter of arges which is 0 at this point isn't it? It makes sense to check for another argument because if its just sm_playerslap Bakuryu it slaps them for no damage, but if its 1 it still technically isn't passing the if statement as both arges needs to be >= 2 and the second argument needs to work. Also there seems to be a ton of variables that aren't declared anywhere maybe I'm missing something, but where did MAX_TARGET_LENGTH come from? Is this a keyword? To start mine off I want to make some text and a menu pop up for the user I am assuming I need to make use of the menu functions, I'm just not sure which ones any examples of a simple menu system? |
Re: Making a plugin tutorial?
Command_Slap is the callback for the command sm_slap, when a client invokes the command through chat/console his/her client id is passed to client and args contains the number of arguments he/she passed. The Command_Slap code block is then run to see what actions should happen. The arguments he/she passed can be retrieved in the form of a string with GetCmdArg. MAX_TARGET_LENGTH is defined in one of the includes the plugin has used to compile. If you look at sourcemod.inc you'll see that it includes other includes, this just creates a large tree of includes. There are many things that are defined with simply including sourcemod.inc. Some examples: NULL_VECTOR PLATFORM_MAX_PATH MAX_NAME_LENGTH
If you simply want to print stuff to the client, look at the various PrintTo... functions in the api. Api here |
Re: Making a plugin tutorial?
Ok that definitely makes a little more sense. Is client and arge a keyword though? alone with MAX_TARGET_LENGTH if so is there a list of these words what they are used for etc? Also won't the PrintTo functions only send texts? how do you make them menus? Shouldn't I look at the Menu functions?
|
Re: Making a plugin tutorial?
Every bold section in the api is an include file that sourcemod.inc includes in itself, with the exception of sdktools and its subsections. Clicking on a bold section will give you the overview of what that include file creates for use within your plugin, usually these are enums and #define variables. I assume you know how different tag types work and how functions return certain tag variables, if so go ahead and try creating a menu/panel by looking at the menus section in the api.
|
Re: Making a plugin tutorial?
Yea I just found the menu section, but its throwing me for a loop. The flow of the code is really weird if I am reading it right. On start it calls the function at the bottom of the code which is weird why do they have the function below what happens next? It generates a menu and then calls a function on how that menu works right? so if each of these pieces of code were assigned a number from top to bottom as 1, 2 and 3 it makes it seem like the order in which its executed is 1, 3, 2 unless I am not reading it right, even though this technically doesn't matter its still confusing to read.
On top of that I'm trying to figure out how to make this menu pop up as soon as the client enters the server, so far I had no luck removing the register command line and inserting the code for creating the menu in its place. Not that I thought this would work, but it was wishful thinking. |
Re: Making a plugin tutorial?
This should work to display a menu when a client gets put in server.
PHP Code:
|
Re: Making a plugin tutorial?
I don't know if its my code or the compiler, but it won't let me try my code so maybe I made a big enough booboo to make the compiler crash here is my code. Based heavily on your example of course. I used if statements instead of case, not sure if that makes a difference or not I mirrored it as close as possible to the case version.
PHP Code:
|
Re: Making a plugin tutorial?
PHP Code:
PHP Code:
|
| All times are GMT -4. The time now is 21:52. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.