-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hermansimensen/dev
Dev
- Loading branch information
Showing
27 changed files
with
10,259 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
# bash2 | ||
# BASH 2.0 | ||
|
||
**Commands** | ||
|
||
```python | ||
bash2_stats - Show strafe stats | ||
|
||
bash2_admin - toggle admin mode, lets you enable/disable printing of bash logs into the chat. | ||
``` | ||
|
||
|
||
**Cvars** | ||
|
||
```python | ||
bash_antinull - lets you disable or enable null kicking | ||
|
||
bash_banlength - lets you set banlength | ||
|
||
bash_autoban - disable/enable automatic banning. | ||
bash_discord - Enable/Disable discord logging | ||
bash_discord_webhook - The url for the discord webhook. | ||
bash_discord_only_bans - If enabled, only kicks and bans will be printed to the discord log. | ||
``` | ||
|
||
### Depencenies | ||
|
||
Discord API (https://github.com/Deathknife/sourcemod-discord) + SteamWorks & SMJansson | ||
|
||
|
||
![Bash2.0 Discord Demo](https://i.imgur.com/lrvCf1F.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#if !defined _SENDPROXYMANAGER_INC_ | ||
#define _SENDPROXYMANAGER_INC_ | ||
|
||
|
||
|
||
enum SendPropType { | ||
Prop_Int = 0, | ||
Prop_Float = 1, | ||
Prop_String = 2, | ||
//Prop_Array = 3, | ||
Prop_Vector = 4, | ||
Prop_Max | ||
}; | ||
|
||
typeset SendProxyCallback | ||
{ | ||
function Action (int entity, const char[] PropName, int &iValue, int element); //Prop_Int | ||
function Action (int entity, const char[] PropName, float &flValue, int element); //Prop_Float | ||
function Action (int entity, const char[] PropName, char modifiedValue[4096], int element); //Prop_String | ||
function Action (int entity, const char[] PropName, float vecValues[3], int element); //Prop_Vector | ||
}; | ||
|
||
typeset SendProxyCallbackGamerules | ||
{ | ||
function Action (const char[] PropName, int &iValue, int element); //Prop_Int | ||
function Action (const char[] PropName, float &flValue, int element); //Prop_Float | ||
function Action (const char[] PropName, char modifiedValue[4096], int element); //Prop_String | ||
function Action (const char[] PropName, float vecValues[3], int element); //Prop_Vector | ||
}; | ||
|
||
typeset PropChangedCallback | ||
{ | ||
function void(int entity, const char[] PropName, const char[] oldValue, const char[] newValue); | ||
}; | ||
|
||
typeset GameRulesPropChangedCallback | ||
{ | ||
function void(const char[] PropName, const char[] oldValue, const char[] newValue); | ||
}; | ||
|
||
//Returns true upon success, false upon failure | ||
native bool SendProxy_Hook(int entity, char[] propname, SendPropType proptype, SendProxyCallback callback); | ||
native bool SendProxy_HookGameRules(char[] propname, SendPropType proptype, SendProxyCallbackGamerules callback); | ||
native bool SendProxy_HookArrayProp(int entity, const char[] name, int element, SendPropType: ype, SendProxyCallback callback); | ||
native bool SendProxy_UnhookArrayProp(int entity, const char[] name, int element, SendPropType type, SendProxyCallback callback); | ||
native bool SendProxy_Unhook(int entity, char[] propname, SendProxyCallback callback); | ||
native bool SendProxy_UnhookGameRules(char[] propname, SendProxyCallbackGamerules callback); | ||
native bool SendProxy_IsHooked(int entity, char[] propname); | ||
native bool SendProxy_IsHookedGameRules(char[] propname); | ||
|
||
native bool SendProxy_HookPropChange(entity, const char[] name, PropChangedCallback callback); | ||
native bool SendProxy_HookPropChangeGameRules(const char[] name, GameRulesPropChangedCallback callback); | ||
native void SendProxy_UnhookPropChange(entity, const char[] name, PropChangedCallback callback); | ||
native void SendProxy_UnhookPropChangeGameRules(const char[] name, GameRulesPropChangedCallback callback); | ||
|
||
#if !defined REQUIRE_EXTENSIONS | ||
public __ext_sendproxymanager_SetNTVOptional() | ||
{ | ||
MarkNativeAsOptional("SendProxy_Hook"); | ||
MarkNativeAsOptional("SendProxy_HookArrayProp"); | ||
MarkNativeAsOptional("SendProxy_Unhook"); | ||
MarkNativeAsOptional("SendProxy_IsHooked"); | ||
MarkNativeAsOptional("SendProxy_HookPropChange"); | ||
MarkNativeAsOptional("SendProxy_UnhookPropChange"); | ||
} | ||
#endif | ||
|
||
public Extension __ext_sendproxymanager = | ||
{ | ||
name = "SendProxy Manager", | ||
file = "sendproxy.ext", | ||
#if defined AUTOLOAD_EXTENSIONS | ||
autoload = 1, | ||
#else | ||
autoload = 0, | ||
#endif | ||
#if defined REQUIRE_EXTENSIONS | ||
required = 1, | ||
#else | ||
required = 0, | ||
#endif | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
#if defined _smlib_array_included | ||
#endinput | ||
#endif | ||
#define _smlib_array_included | ||
|
||
#include <sourcemod> | ||
|
||
/** | ||
* Returns the index for the first occurance of the given value. | ||
* If the value cannot be found, -1 will be returned. | ||
* | ||
* @param array Static Array. | ||
* @param size Size of the Array. | ||
* @param value Value to search for. | ||
* @param start Optional: Offset where to start (0 - (size-1)). | ||
* @return Array index, or -1 if the value couldn't be found. | ||
*/ | ||
stock int Array_FindValue(any[] array, int size, any value, int start=0) | ||
{ | ||
if (start < 0) { | ||
start = 0; | ||
} | ||
|
||
for (int i=start; i < size; i++) { | ||
|
||
if (array[i] == value) { | ||
return i; | ||
} | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
/** | ||
* Searchs for the first occurance of a string in the array. | ||
* If the value cannot be located, -1 will be returned. | ||
* | ||
* @param array Static Array. | ||
* @param size Size of the Array. | ||
* @param value String to search for. | ||
* @param start Optional: Offset where to start(0 - (size-1)). | ||
* @return Array index, or -1 if the value couldn't be found. | ||
*/ | ||
stock int Array_FindString(const char[][] array, int size, const char[] str, bool caseSensitive=true, int start=0) | ||
{ | ||
if (start < 0) { | ||
start = 0; | ||
} | ||
|
||
for (int i=start; i < size; i++) { | ||
|
||
if (StrEqual(array[i], str, caseSensitive)) { | ||
return i; | ||
} | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
/** | ||
* Returns the Index of the Lowest value in the array | ||
* | ||
* @param array Static Array. | ||
* @param size Size of the Array. | ||
* @param start Optional: Offset where to start (0 - (size-1)). | ||
* @return Array index. | ||
*/ | ||
stock int Array_FindLowestValue(any[] array, int size, int start=0) | ||
{ | ||
if (start < 0) { | ||
start = 0; | ||
} | ||
|
||
any value = array[start]; | ||
any tempValue; | ||
int x = start; | ||
|
||
for (int i=start; i < size; i++) { | ||
|
||
tempValue = array[i]; | ||
|
||
if (tempValue < value) { | ||
value = tempValue; | ||
x = i; | ||
} | ||
|
||
} | ||
|
||
return x; | ||
} | ||
|
||
/** | ||
* Returns the Index of the Highest value in the array | ||
* | ||
* @param array Static Array. | ||
* @param size Size of the Array. | ||
* @param start Optional: Offset where to start (0 - (size-1)). | ||
* @return Array index. | ||
*/ | ||
stock int Array_FindHighestValue(any[] array, int size, int start=0) | ||
{ | ||
if (start < 0) { | ||
start = 0; | ||
} | ||
|
||
any value = array[start]; | ||
any tempValue; | ||
int x = start; | ||
|
||
for (int i=start; i < size; i++) { | ||
|
||
tempValue = array[i]; | ||
|
||
if (tempValue > value) { | ||
value = tempValue; | ||
x = i; | ||
} | ||
|
||
} | ||
|
||
return x; | ||
} | ||
|
||
/** | ||
* Fills an array with a given value in a 1 dimensional static array. | ||
* You can specify the amount of cells to be written. | ||
* | ||
* @param array Static Array. | ||
* @param size Number of cells to write (eg. the array's size) | ||
* @param value Fill value. | ||
* @param start Optional: Offset where to start (0 - (size-1)). | ||
* @noreturn | ||
*/ | ||
stock void Array_Fill(any[] array, int size, any value, int start=0) | ||
{ | ||
if (start < 0) { | ||
start = 0; | ||
} | ||
|
||
for (int i=start; i < size; i++) { | ||
array[i] = value; | ||
} | ||
} | ||
|
||
/** | ||
* Copies a 1 dimensional static array. | ||
* | ||
* @param array Static Array to copy from. | ||
* @param newArray New Array to copy to. | ||
* @param size Size of the array (or number of cells to copy) | ||
* @noreturn | ||
*/ | ||
stock void Array_Copy(const any[] array, any[] newArray, int size) | ||
{ | ||
for (int i=0; i < size; i++) { | ||
newArray[i] = array[i]; | ||
} | ||
} |
Oops, something went wrong.