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

[L4D & L4D2] Plugin template


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Earendil
Senior Member
Join Date: Jan 2020
Location: Spain
Old 02-18-2024 , 13:24   [L4D & L4D2] Plugin template
Reply With Quote #1

About:
When starting to write a new plugin there are a few things that always have to be added, and writing again and again, or making copy/paste and test the same piece of code constantly becomes very tedious.
So, since I'm very lazy I did this template to stop writing the same logic one time after another.
Features:
  • Is just a plugin that can be switched on/off.
  • Detects game and fails to load if is not L4D Series.
  • Basic general ConVars to enable/disable plugin globally and by gamemode.
  • Optionally include Left 4 DHooks.
  • Code that will be compiled or ignored based on Left 4 DHooks.
  • Comments and descriptions within the code.

Special thanks:
  • Silvers, gamemode logic is based on his code and he pointed how to use Left4DHooks to get gamemode.


Installation options:
There are different ways to get the code and start modifying, obviously is possible to do by downloading the attached .sp file and copying it in your computer, but there are more sophisticated ways.
  • Use GitHub Codespaces: Since the GitHub repository is a Template you can get the code and start modifying it in a codespace (in the same browser or with VSCode extension).
  • Clone repository: If you have git installed in your computer you can easily clone the repository and then get rid of the git to have the code disconnected from the template:
    First clone the code in your computer:
    Code:
    git clone https://github.com/Earendil-89/l4d_template.git <folder_name>
    Then disconnect the local repository to the template repository (cmd/*terminal must be in the project folder):
    Code:
    git remote remove origin
    Aditionally(and recommended) you can remove all commits to have an empty project and initialize your own repository (cmd/terminal must be on the project folder):
    Windows:
    Code:
    rmdir /S .git
    Linux:
    Code:
    rm -rf .git
GitHub
Attached Files
File Type: sp Get Plugin or Get Source (l4d_template.sp - 100 views - 11.7 KB)
__________________
>>My plugins<<
>>GitHub<<

Last edited by Earendil; 02-21-2024 at 13:06. Reason: Fix windows command
Earendil is offline
Gold Fish
Senior Member
Join Date: Mar 2020
Old 02-18-2024 , 14:16   Re: [L4D & L4D2] Plugin template
Reply With Quote #2

__________________
-

PHP Code:
public OnClientConnect(int Client) {
    
KickClient(Client"sorry");

Gold Fish 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 10:48.


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