Infractions - The Early Stages
Hello to you all. I just started learning how to write a plugin for my server, since I could not seem to find anything that met my needs. It's in its very early stages, and I don't have that much experience with the SourcePawn language, but seeing as it's very similar in structure to C++/Java, I have been not having too much issue. I'm going to post a link to what I have so far, since it's a little lengthy: https://pastebin.com/VkuKxuGW
Here's my mental map for what Infractions is supposed to accomplish:
However, at this point I seem to be suffering from a combination of writer's block and confusion, and have a few questions that may help guide me:
(PS, Mods/Admins who noticed that I posted this in the AMX scripting section first by mistake, I apologise :( ) |
Re: Infractions - The Early Stages
Nice idea!
You can use GetCmdArg in the listener callback just like you would in a regular command, and get the target/process whatever you'd like in there. If you wanna know exactly how target is found from the name, you can check how the stock sourcemod functions do it as an example. More info: https://sm.alliedmods.net/new-api/co...ommandListener As for creating the file you can use the file class: https://sm.alliedmods.net/new-api/files/File Lets you read and write whatever you'd like, for examples I'd take a look at how other plugins do it. |
Re: Infractions - The Early Stages
Quote:
If you don't care to support multiple client targeting like @ct or @t then I'd just use FindTarget like I do here. Quote:
Quote:
|
Re: Infractions - The Early Stages
Quote:
If an admin runs, for example, sm_mute MicSpammer, I'd like to be able to use the "MicSpammer" part of the command as an argument for stacking infractions on them. Whether or not it's by using their username, user ID, SteamID, whatever, just...something unique to them. When I write the file, though, using SteamID would definitely make the most sense, as to prevent punishment dodging via name-changing. Quote:
|
Re: Infractions - The Early Stages
To get the targetting to work same as sourcemod stock functions I'd just copy paste their targetting code since it all applies to yours. I'd use this as reference instead of kick since it takes multiple arguments, which most of the commands you're hooking will be: https://github.com/alliedmodders/sou...n.sp#L266-L305
|
Re: Infractions - The Early Stages
Quote:
If I have my own command, say, sm_infractions_increment, which will force an increment of a set amount to a player, and also a hook to sm_kick, sm_ban, etc. - should I just have both the command hook callback AND the actual "custom" command call the same function, say, Command_IncrementInfraction? To me, it would seem silly to have to have two different functions that do the same thing, just with different inputs(?), but that may be an oversight on my part. |
Re: Infractions - The Early Stages
Yea you can hook them all to the same listener since they all take target as first argument I think but you'd have to figure out which command it came from and how many infractions to give them accordingly.
|
Re: Infractions - The Early Stages
Quote:
Quote:
Spoiler
EDIT: Give me a few minutes I'll give you some code Here's some inspiration PHP Code:
|
Re: Infractions - The Early Stages
EDIT: im big dumbo, nevermind
|
Re: Infractions - The Early Stages
You could have a look at this plugin which does most of what you want. I know you do this for learning purposes, but maybe you want to extend that plugin and add the other features you had in mind.
https://forums.alliedmods.net/showthread.php?t=197853 |
All times are GMT -4. The time now is 16:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.