Reklam gösterimini engelleyici yazılım kullandığınızı görüyoruz.
Sitemizin ayakta kalıp sizlere hizmet edebilmek için en büyük gelir kaynağı sayfamızda gösterilen reklamlardır.
Reklam gösterimde bizim sayfamıza ayrıcalık tanıyarak ayakta kalmamıza destek olmak ister misiniz ?

Smdiscord <> sourcemod chat delay

Konu

#1
shavitush/smdiscord 
Pluginini compile ederken sorun yaşadım. Compile edip gönderir misiniz?

Bu pluginin çalışması için farklı pluginler gerekiyorsa kurulması gereken onları da hem isimlerini yazıp, en son halini tekrar compile edip atar mısınız? 



not2easy Steam Grubu'na katılarak topluluğumuza destekde bulunabilirsiniz.
#2
Son Düzenleme: 06-07-2018, Saat: 10:08, Düzenleyen: Kirito.
@ alphaearth Dostum sorun include'ların sunucuda bulunmamasından kaynaklanıyor. Ben direk plugin içine entegre ettim ve 1-2 hata vardı düzelttim.

PHP Kod:
/*
 * SourceMod <-> Discord
 * by: shavit
 *
 * This file is part of SourceMod <-> Discord.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 *
*/

#include <sourcemod>
/**
 * =============================================================================
 * Dynamic for SourceMod (C)2016 Matthew J Dunn.   All rights reserved.
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#if defined _dynamic_included
 
 #endinput
#endif
#define _dynamic_included

#if defined dynamic_use_local_methodmap
    #define INVALID_DYNAMIC_OBJECT            view_as<DynamicObject>(-1)
#else
    #define INVALID_DYNAMIC_OBJECT            view_as<Dynamic>(-1)
#endif
#define Invalid_Dynamic_Object            -1
#define INVALID_DYNAMIC_OFFSET            -1
#define DYNAMIC_MEMBERNAME_MAXLEN        64

enum Dynamic_MemberType
{
    
DynamicType_Int 0,
    
DynamicType_Float 1,
    
DynamicType_String 2,
    
DynamicType_Object 3,
    
DynamicType_Dynamic 3,
    
DynamicType_Bool 4,
    
DynamicType_Handle 5,
    
DynamicType_Vector 6,
    
DynamicType_Unknown 7
}

enum Dynamic_Operator
{
    
DynamicOperator_Equals=0,
    
DynamicOperator_NotEquals,
}

typeset Dynamic_HookType
{
    
// HookChanges
    
function void (Dynamic objint offset, const char[] memberDynamic_MemberType type);
    
    
// DynamicReadKeyValue
    
function Action (Dynamic obj, const char[] memberint depth);
}

native int Dynamic_GetCollectionSize();

native Dynamic Dynamic_Initialise(int blocksize=64int startsize=0bool persistent=false);
native bool Dynamic_IsValid(int indexbool throwerror=false);
native bool Dynamic_Dispose(int indexbool disposemembers=true);
native bool Dynamic_ResetObject(int indexbool disposemembers=trueint blocksize=0int startsize=0);
native Handle Dynamic_GetOwnerPlugin(Dynamic obj);

native bool Dynamic_SetName(Dynamic obj, const char[] objectnamebool replace=false);
native Dynamic Dynamic_FindByName(const char[] objectname);
native Dynamic Dynamic_GetParent(Dynamic obj);
native bool Dynamic_GetName(Dynamic objchar[] bufferint length);

native bool Dynamic_GetPersistence(Dynamic obj);
native bool Dynamic_SetPersistence(Dynamic objbool value);

native bool Dynamic_ReadConfig(Dynamic obj, const char[] pathbool use_valve_fs=falseint valuelength=256);
native bool Dynamic_WriteConfig(Dynamic obj, const char[] path);

native bool Dynamic_ReadKeyValues(Dynamic obj, const char[] pathint valuelengthDynamic_HookType callback=INVALID_FUNCTION);
native bool Dynamic_WriteKeyValues(Dynamic obj, const char[] path, const char[] basekey);

native int Dynamic_GetMemberCount(Dynamic obj);
native int Dynamic_GetMemberOffset(Dynamic obj, const char[] membername);
native int Dynamic_GetMemberOffsetByIndex(Dynamic objint index);
native bool Dynamic_GetMemberNameByIndex(Dynamic objint indexchar[] bufferint length);
native bool Dynamic_GetMemberNameByOffset(Dynamic objint offsetchar[] bufferint length);
native Dynamic_MemberType Dynamic_GetMemberType(Dynamic obj, const char[] membername);
native Dynamic_MemberType Dynamic_GetMemberTypeByOffset(Dynamic objint offset);
native bool Dynamic_SortMembers(Dynamic objSortOrder order);
native ArrayList Dynamic_FindByMemberValue(Dynamic objDynamic params);

native int Dynamic_CallbackCount(Dynamic obj);
native bool Dynamic_HookChanges(Dynamic objDynamic_HookType callback);
native bool Dynamic_UnHookChanges(Dynamic objDynamic_HookType callback);

native int Dynamic_GetInt(Dynamic obj, const char[] membernameint defaultvalue=-1);
native int Dynamic_SetInt(Dynamic obj, const char[] membernameint value);
native int Dynamic_GetIntByOffset(Dynamic objint offsetint defaultvalue=-1);
native bool Dynamic_SetIntByOffset(Dynamic objint offsetint value);
native int Dynamic_PushInt(Dynamic objint value, const char[] name="");
native int Dynamic_GetIntByIndex(Dynamic objint indexint defaultvalue=-1);

native float Dynamic_GetFloat(Dynamic obj, const char[] membernamefloat defaultvalue=-1.0);
native int Dynamic_SetFloat(Dynamic obj, const char[] membernamefloat value);
native float Dynamic_GetFloatByOffset(Dynamic objint offsetfloat defaultvalue=-1.0);
native bool Dynamic_SetFloatByOffset(Dynamic objint offsetfloat value);
native int Dynamic_PushFloat(Dynamic objfloat value, const char[] name="");
native float Dynamic_GetFloatByIndex(Dynamic objint indexfloat defaultvalue=-1.0);

native bool Dynamic_GetString(Dynamic obj, const char[] membernamechar[] bufferint length);
native int Dynamic_SetString(Dynamic obj, const char[] membername, const char[] valueint length=0);
native bool Dynamic_GetStringByOffset(Dynamic objint offsetchar[] bufferint length);
native bool Dynamic_SetStringByOffset(Dynamic objint offset, const char[] valueint length=0);
native int Dynamic_PushString(Dynamic obj, const char[] valueint length=0, const char[] name="");
native bool Dynamic_GetStringByIndex(Dynamic objint indexchar[] bufferint length);
native int Dynamic_GetStringLength(Dynamic obj, const char[] membername);
native int Dynamic_GetStringLengthByOffset(Dynamic objint offset);
native bool Dynamic_CompareString(Dynamic obj, const char[] membername, const char[] valuebool casesensitive=true);

// This can be removed at some point in the future
#pragma deprecated Use Dynamic_GetDynamic() instead
native Dynamic Dynamic_GetObject(Dynamic obj, const char[] membername);
#pragma deprecated Use Dynamic_SetDynamic() instead
native int Dynamic_SetObject(Dynamic obj, const char[] membernameDynamic value);
#pragma deprecated Use Dynamic_GetDynamicByOffset() instead
native Dynamic Dynamic_GetObjectByOffset(Dynamic objint offset);
#pragma deprecated Use Dynamic_SetDynamicByOffset() instead
native bool Dynamic_SetObjectByOffset(Dynamic objint offsetDynamic value);
#pragma deprecated Use Dynamic_PushDynamic() instead
native int Dynamic_PushObject(Dynamic objDynamic value, const char[] name="");
#pragma deprecated Use Dynamic_GetDynamicByIndex() instead
native Dynamic Dynamic_GetObjectByIndex(Dynamic objint index);
#pragma deprecated Use Dynamic_SetDynamicByIndex() instead
native bool Dynamic_SetObjectByIndex(Dynamic objint indexDynamic value);

native Dynamic Dynamic_GetDynamic(Dynamic obj, const char[] membername);
native int Dynamic_SetDynamic(Dynamic obj, const char[] membernameDynamic value);
native Dynamic Dynamic_GetDynamicByOffset(Dynamic objint offset);
native bool Dynamic_SetDynamicByOffset(Dynamic objint offsetDynamic value);
native int Dynamic_PushDynamic(Dynamic objDynamic value, const char[] name="");
native Dynamic Dynamic_GetDynamicByIndex(Dynamic objint index);
native bool Dynamic_SetDynamicByIndex(Dynamic objint indexDynamic value);

native bool Dynamic_GetBool(Dynamic obj, const char[] membernamebool defaultvalue=false);
native int Dynamic_SetBool(Dynamic obj, const char[] membernamebool value);
native bool Dynamic_GetBoolByOffset(Dynamic objint offsetbool defaultvalue=false);
native bool Dynamic_SetBoolByOffset(Dynamic objint offsetbool value);
native int Dynamic_PushBool(Dynamic objbool value, const char[] name="");
native bool Dynamic_GetBoolByIndex(Dynamic objint indexbool defaultvalue=false);

native Handle Dynamic_GetHandle(Dynamic obj, const char[] membername);
native int Dynamic_SetHandle(Dynamic obj, const char[] membernameHandle value);
native Handle Dynamic_GetHandleByOffset(Dynamic objint offset);
native bool Dynamic_SetHandleByOffset(Dynamic objint offsetHandle value);
native int Dynamic_PushHandle(Dynamic objHandle value, const char[] name="");
native Handle Dynamic_GetHandleByIndex(Dynamic objint index);

native bool Dynamic_GetVector(Dynamic obj, const char[] membernamefloat value[3]);
native int Dynamic_SetVector(Dynamic obj, const char[] membername, const float value[3]);
native bool Dynamic_GetVectorByOffset(Dynamic objint offsetfloat value[3]);
native bool Dynamic_SetVectorByOffset(Dynamic objint offset, const float value[3]);
native int Dynamic_PushVector(Dynamic obj, const float value[3], const char[] name="");
native bool Dynamic_GetVectorByIndex(Dynamic objint indexfloat value[3]);

methodmap Dynamic
{
#if defined dynamic_persistent
    
public Dynamic(int blocksize=64int startsize=0bool persistent=true)
    {
        return 
Dynamic_Initialise(blocksizestartsizepersistent);
    }
#else
    
public Dynamic(int blocksize=64int startsize=0bool persistent=false)
    {
        return 
Dynamic_Initialise(blocksizestartsizepersistent);
    }
#endif
    
    
property int IsValid
    
{
        public 
get()
        {
            return 
Dynamic_IsValid(view_as<int>(this), false);
        }
    }
    
    
property bool Persistent
    
{
        public 
get()
        {
            return 
Dynamic_GetPersistence(this);
        }
        public 
set(bool value)
        {
            
Dynamic_SetPersistence(thisvalue);
        }
    }
    
    
property Dynamic Parent
    
{
        public 
get()
        {
            return 
Dynamic_GetParent(this);
        }
    }
    
    public 
bool GetName(char[] bufferint length)
    {
        return 
Dynamic_GetName(thisbufferlength);
    }
    
    
property int MemberCount
    
{
        public 
get()
        {
            return 
Dynamic_GetMemberCount(this);
        }
    }
    
    public 
void Dispose(bool disposemembers=true)
    {
        
Dynamic_Dispose(view_as<int>(this), disposemembers);
    }
    
    public 
bool Reset(bool disposemembers=trueint blocksize=0int startsize=0)
    {
        return 
Dynamic_ResetObject(view_as<int>(this), disposemembersblocksizestartsize);
    }
    
    
property Handle OwnerPlugin
    
{
        public 
get()
        {
            return 
Dynamic_GetOwnerPlugin(this);
        }
    }
    
    public 
bool SetName(const char[] objectnamebool replace=false)
    {
        return 
Dynamic_SetName(thisobjectnamereplace);
    }
    
    public static 
Dynamic FindByName(const char[] objectname)
    {
        return 
Dynamic_FindByName(objectname);
    }
    
    public 
bool ReadConfig(const char[] pathbool use_valve_fs falseint valuelength=256)
    {
        return 
Dynamic_ReadConfig(thispathuse_valve_fsvaluelength);
    }
    
    public 
bool WriteConfig(const char[] path)
    {
        return 
Dynamic_WriteConfig(thispath);
    }
    
    public 
bool ReadKeyValues(const char[] pathint valuelength 256Dynamic_HookType callback INVALID_FUNCTION)
    {
        return 
Dynamic_ReadKeyValues(thispathvaluelengthcallback);
    }
    
    public 
bool WriteKeyValues(const char[] path, const char[] basekey="")
    {
        return 
Dynamic_WriteKeyValues(thispathbasekey);
    }
    
    public static 
Dynamic GetSettings()
    {
        return 
view_as<Dynamic>(0);
    }
    
    public static 
Dynamic GetPlayerSettings(int client)
    {
        return 
view_as<Dynamic>(client);
    }
    
    public 
int GetInt(const char[] membernameint defaultvalue=-1)
    {
        return 
Dynamic_GetInt(thismembernamedefaultvalue);
    }
    
    public 
int SetInt(const char[] membernameint value)
    {
        return 
Dynamic_SetInt(thismembernamevalue);
    }
    
    public 
int GetIntByOffset(int offsetint defaultvalue=-1)
    {
        return 
Dynamic_GetIntByOffset(thisoffsetdefaultvalue);
    }
    
    public 
void SetIntByOffset(int offsetint value)
    {
        
Dynamic_SetIntByOffset(thisoffsetvalue);
    }
    
    public 
int PushInt(int value, const char[] name="")
    {
        return 
Dynamic_PushInt(thisvaluename);
    }
    
    public 
int GetIntByIndex(int indexint defaultvalue=-1)
    {
        return 
Dynamic_GetIntByIndex(thisindexdefaultvalue);
    }
    
    public 
bool GetBool(const char[] membernamebool defaultvalue false)
    {
        return 
Dynamic_GetBool(thismembernamedefaultvalue);
    }
    
    public 
int SetBool(const char[] membernamebool value)
    {
        return 
Dynamic_SetBool(thismembernamevalue);
    }
    
    public 
bool GetBoolByOffset(int offsetbool defaultvalue false)
    {
        return 
Dynamic_GetBoolByOffset(thisoffsetdefaultvalue);
    }
    
    public 
void SetBoolByOffset(int offsetbool value)
    {
        
Dynamic_SetBoolByOffset(thisoffsetvalue);
    }
    
    public 
int PushBool(bool value, const char[] name="")
    {
        return 
Dynamic_PushBool(thisvaluename);
    }
    
    public 
bool GetBoolByIndex(int indexbool defaultvalue false)
    {
        return 
Dynamic_GetBoolByIndex(thisindexdefaultvalue);
    }
    
    public 
float GetFloat(const char[] membernamefloat defaultvalue=-1.0)
    {
        return 
Dynamic_GetFloat(thismembernamedefaultvalue);
    }
    
    public 
int SetFloat(const char[] membernamefloat value)
    {
        return 
Dynamic_SetFloat(thismembernamevalue);
    }
    
    public 
float GetFloatByOffset(int offsetfloat defaultvalue=-1.0)
    {
        return 
Dynamic_GetFloatByOffset(thisoffsetdefaultvalue);
    }
    
    public 
void SetFloatByOffset(int offsetfloat value)
    {
        
Dynamic_SetFloatByOffset(thisoffsetvalue);
    }
    
    public 
int PushFloat(float value, const char[] name="")
    {
        return 
Dynamic_PushFloat(thisvaluename);
    }
    
    public 
float GetFloatByIndex(int indexfloat defaultvalue=-1.0)
    {
        return 
Dynamic_GetFloatByIndex(thisindexdefaultvalue);
    }
    
    public 
bool GetString(const char[] membernamechar[] bufferint length)
    {
        return 
Dynamic_GetString(thismembernamebufferlength);
    }
    
    public 
int SetString(const char[] membername, const char[] valueint length=0)
    {
        return 
Dynamic_SetString(thismembernamevaluelength);
    }
    
    public 
int GetStringByOffset(int offsetchar[] bufferint length)
    {
        return 
Dynamic_GetStringByOffset(thisoffsetbufferlength);
    }
    
    public 
void SetStringByOffset(const int offset, const char[] valueint length=0)
    {
        
Dynamic_SetStringByOffset(thisoffsetvaluelength);
    }
    
    public 
int PushString(const char[] valueint length=0, const char[] name="")
    {
        return 
Dynamic_PushString(thisvaluelengthname);
    }
    
    public 
bool GetStringByIndex(int indexchar[] bufferint length)
    {
        return 
Dynamic_GetStringByIndex(thisindexbufferlength);
    }
    
    public 
int GetStringLength(const char[] membername)
    {
        return 
Dynamic_GetStringLength(thismembername);
    }
    
    public 
int GetStringLengthByOffset(int offset)
    {
        return 
Dynamic_GetStringLengthByOffset(thisoffset);
    }
    
    public 
bool CompareString(const char[] membername, const char[] valuebool casesensitive=true)
    {
        return 
Dynamic_CompareString(thismembernamevaluecasesensitive);
    }
    
    
#pragma deprecated Use .GetDynamic() instead
    
public Dynamic GetObject(const char[] membername)
    {
        return 
Dynamic_GetDynamic(thismembername);
    }
    
    
#pragma deprecated Use .SetDynamic() instead
    
public int SetObject(const char[] membernameDynamic value)
    {
        return 
Dynamic_SetDynamic(thismembernamevalue);
    }
    
    
#pragma deprecated Use .SetDynamicByOffset() instead
    
public Dynamic GetObjectByOffset(int offset)
    {
        return 
Dynamic_GetDynamicByOffset(thisoffset);
    }
    
    
#pragma deprecated Use .SetDynamicByOffset() instead
    
public void SetObjectByOffset(int offsetDynamic value)
    {
        
Dynamic_SetDynamicByOffset(thisoffsetvalue);
    }
    
    
#pragma deprecated Use .PushDynamic() instead
    
public int PushObject(Dynamic value, const char[] name="")
    {
        return 
Dynamic_PushDynamic(thisvaluename);
    }
    
    
#pragma deprecated Use .GetDynamicByIndex() instead
    
public Dynamic GetObjectByIndex(int index)
    {
        return 
Dynamic_GetDynamicByIndex(thisindex);
    }
    
    
#pragma deprecated Use .SetDynamicByIndex() instead
    
public bool SetObjectByIndex(int indexDynamic value)
    {
        return 
Dynamic_SetDynamicByIndex(thisindexvalue);
    }
    
    public 
Dynamic GetDynamic(const char[] membername)
    {
        return 
Dynamic_GetDynamic(thismembername);
    }
    
    public 
int SetDynamic(const char[] membernameDynamic value)
    {
        return 
Dynamic_SetDynamic(thismembernamevalue);
    }
    
    public 
Dynamic GetDynamicByOffset(int offset)
    {
        return 
Dynamic_GetDynamicByOffset(thisoffset);
    }
    
    public 
void SetDynamicByOffset(int offsetDynamic value)
    {
        
Dynamic_SetDynamicByOffset(thisoffsetvalue);
    }
    
    public 
int PushDynamic(Dynamic value, const char[] name="")
    {
        return 
Dynamic_PushDynamic(thisvaluename);
    }
    
    public 
Dynamic GetDynamicByIndex(int index)
    {
        return 
Dynamic_GetDynamicByIndex(thisindex);
    }
    
    public 
bool SetDynamicByIndex(int indexDynamic value)
    {
        return 
Dynamic_SetDynamicByIndex(thisindexvalue);
    }
    
    public 
Handle GetHandle(const char[] membername)
    {
        return 
Dynamic_GetHandle(thismembername);
    }
    
    public 
int SetHandle(const char[] membernameHandle value)
    {
        return 
Dynamic_SetHandle(thismembernamevalue);
    }
    
    public 
Handle GetHandleByOffset(int offset)
    {
        return 
Dynamic_GetHandleByOffset(thisoffset);
    }
    
    public 
void SetHandleByOffset(int offsetHandle value)
    {
        
Dynamic_SetHandleByOffset(thisoffsetvalue);
    }
    
    public 
int PushHandle(Handle value, const char[] name="")
    {
        return 
Dynamic_PushHandle(thisvaluename);
    }
    
    public 
Handle GetHandleByIndex(int index)
    {
        return 
Dynamic_GetHandleByIndex(thisindex);
    }
    
    public 
bool GetVector(const char[] membernamefloat value[3])
    {
        return 
Dynamic_GetVector(thismembernamevalue);
    }
    
    public 
int SetVector(const char[] membername, const float value[3])
    {
        return 
Dynamic_SetVector(thismembernamevalue);
    }
    
    public 
bool GetVectorByOffset(int offsetfloat[3value)
    {
        return 
Dynamic_GetVectorByOffset(thisoffsetvalue);
    }
    
    public 
void SetVectorByOffset(int offset, const float[3value)
    {
        
Dynamic_SetVectorByOffset(thisoffsetvalue);
    }
    
    public 
int PushVector(const float value[3], const char[] name="")
    {
        return 
Dynamic_PushVector(thisvaluename);
    }
    
    public 
bool GetVectorByIndex(int indexfloat[3value)
    {
        return 
Dynamic_GetVectorByIndex(thisindexvalue);
    }
    
    public 
void HookChanges(Dynamic_HookType callback)
    {
        
Dynamic_HookChanges(thiscallback);    
    }
    
    public 
void UnHookChanges(Dynamic_HookType callback)
    {
        
Dynamic_UnHookChanges(thiscallback);
    }
    
    public 
int CallbackCount()
    {
        return 
Dynamic_CallbackCount(this);
    }
    
    public 
int GetMemberOffset(const char[] membername)
    {
        return 
Dynamic_GetMemberOffset(thismembername);
    }
    
    public 
Dynamic_MemberType GetMemberType(int offset)
    {
        return 
Dynamic_GetMemberTypeByOffset(thisoffset);
    }
    
    public 
bool GetMemberNameByIndex(int indexchar[] bufferint length)
    {
        return 
Dynamic_GetMemberNameByIndex(thisindexbufferlength);
    }
    
    public 
int GetMemberOffsetByIndex(int index)
    {
        return 
Dynamic_GetMemberOffsetByIndex(thisindex);
    }
    
    public 
bool GetMemberNameByOffset(int offsetchar[] bufferint length)
    {
        return 
Dynamic_GetMemberNameByOffset(thisoffsetbufferlength);
    }
    
    public 
bool SortMembers(SortOrder order Sort_Ascending)
    {
        return 
Dynamic_SortMembers(thisorder);
    }
    
    public 
ArrayList FindByMemberValue(Dynamic params)
    {
        return 
Dynamic_FindByMemberValue(thisparams);
    }
}



#if !defined REQUIRE_PLUGIN
public __pl_dynamic_SetNTVOptional()
{
    
MarkNativeAsOptional("Dynamic_Initialise");
    
MarkNativeAsOptional("Dynamic_IsValid");
    
MarkNativeAsOptional("Dynamic_Dispose");
    
MarkNativeAsOptional("Dynamic_ResetObject");
    
MarkNativeAsOptional("Dynamic_GetOwnerPlugin");
    
MarkNativeAsOptional("Dynamic_SetName");
    
MarkNativeAsOptional("Dynamic_FindByName");
    
MarkNativeAsOptional("Dynamic_GetParent");
    
MarkNativeAsOptional("Dynamic_GetName");
    
MarkNativeAsOptional("Dynamic_GetPersistence");
    
MarkNativeAsOptional("Dynamic_SetPersistence");
    
MarkNativeAsOptional("Dynamic_ReadConfig");
    
MarkNativeAsOptional("Dynamic_WriteConfig");
    
MarkNativeAsOptional("Dynamic_ReadKeyValues");
    
MarkNativeAsOptional("Dynamic_WriteKeyValues");
    
MarkNativeAsOptional("Dynamic_GetInt");
    
MarkNativeAsOptional("Dynamic_SetInt");
    
MarkNativeAsOptional("Dynamic_GetIntByOffset");
    
MarkNativeAsOptional("Dynamic_SetIntByOffset");
    
MarkNativeAsOptional("Dynamic_PushInt");
    
MarkNativeAsOptional("Dynamic_GetIntByIndex");
    
MarkNativeAsOptional("Dynamic_GetBool");
    
MarkNativeAsOptional("Dynamic_SetBool");
    
MarkNativeAsOptional("Dynamic_GetBoolByOffset");
    
MarkNativeAsOptional("Dynamic_SetBoolByOffset");
    
MarkNativeAsOptional("Dynamic_PushBool");
    
MarkNativeAsOptional("Dynamic_GetBoolByIndex");
    
MarkNativeAsOptional("Dynamic_GetFloat");
    
MarkNativeAsOptional("Dynamic_SetFloat");
    
MarkNativeAsOptional("Dynamic_GetFloatByOffset");
    
MarkNativeAsOptional("Dynamic_SetFloatByOffset");
    
MarkNativeAsOptional("Dynamic_PushFloat");
    
MarkNativeAsOptional("Dynamic_GetFloatByIndex");
    
MarkNativeAsOptional("Dynamic_GetString");
    
MarkNativeAsOptional("Dynamic_SetString");
    
MarkNativeAsOptional("Dynamic_GetStringByOffset");
    
MarkNativeAsOptional("Dynamic_SetStringByOffset");
    
MarkNativeAsOptional("Dynamic_PushString");
    
MarkNativeAsOptional("Dynamic_GetStringByIndex");
    
MarkNativeAsOptional("Dynamic_GetStringLength");
    
MarkNativeAsOptional("Dynamic_GetStringLengthByOffset");
    
MarkNativeAsOptional("Dynamic_CompareString");
    
MarkNativeAsOptional("Dynamic_GetObject");
    
MarkNativeAsOptional("Dynamic_SetObject");
    
MarkNativeAsOptional("Dynamic_GetObjectByOffset");
    
MarkNativeAsOptional("Dynamic_SetObjectByOffset");
    
MarkNativeAsOptional("Dynamic_PushObject");
    
MarkNativeAsOptional("Dynamic_GetObjectByIndex");
    
MarkNativeAsOptional("Dynamic_SetObjectByIndex");
    
    
MarkNativeAsOptional("Dynamic_GetDynamic");
    
MarkNativeAsOptional("Dynamic_SetDynamic");
    
MarkNativeAsOptional("Dynamic_GetDynamicByOffset");
    
MarkNativeAsOptional("Dynamic_SetDynamicByOffset");
    
MarkNativeAsOptional("Dynamic_PushDynamic");
    
MarkNativeAsOptional("Dynamic_GetDynamicByIndex");
    
MarkNativeAsOptional("Dynamic_SetDynamicByIndex");
    
    
MarkNativeAsOptional("Dynamic_GetHandle");
    
MarkNativeAsOptional("Dynamic_SetHandle");
    
MarkNativeAsOptional("Dynamic_GetHandleByOffset");
    
MarkNativeAsOptional("Dynamic_SetHandleByOffset");
    
MarkNativeAsOptional("Dynamic_PushHandle");
    
MarkNativeAsOptional("Dynamic_GetHandleByIndex");
    
MarkNativeAsOptional("Dynamic_GetVector");
    
MarkNativeAsOptional("Dynamic_SetVector");
    
MarkNativeAsOptional("Dynamic_GetVectorByOffset");
    
MarkNativeAsOptional("Dynamic_SetVectorByOffset");
    
MarkNativeAsOptional("Dynamic_PushVector");
    
MarkNativeAsOptional("Dynamic_GetVectorByIndex");
    
MarkNativeAsOptional("Dynamic_GetCollectionSize");
    
MarkNativeAsOptional("Dynamic_GetMemberCount");
    
MarkNativeAsOptional("Dynamic_HookChanges");
    
MarkNativeAsOptional("Dynamic_UnHookChanges");
    
MarkNativeAsOptional("Dynamic_CallbackCount");
    
MarkNativeAsOptional("Dynamic_GetMemberOffset");
    
MarkNativeAsOptional("Dynamic_GetMemberOffsetByIndex");
    
MarkNativeAsOptional("Dynamic_GetMemberType");
    
MarkNativeAsOptional("Dynamic_GetMemberTypeByOffset");
    
MarkNativeAsOptional("Dynamic_GetMemberNameByIndex");
    
MarkNativeAsOptional("Dynamic_GetMemberNameByOffset");
    
MarkNativeAsOptional("Dynamic_SortMembers");
    
MarkNativeAsOptional("Dynamic_FindByMemberValue");
}
#endif

public SharedPlugin __pl_dynamic 
{
    
name "dynamic",
    
file "dynamic.smx",
    
#if defined REQUIRE_PLUGIN
        
required 1,
    
#else
        
required 0,
    
#endif
};
/**
 * =============================================================================
 * Dynamic for SourceMod (C)2016 Matthew J Dunn.   All rights reserved.
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#if defined _dynamic_collection_included
 
 #endinput
#endif
#define _dynamic_collection_included

/*
    This methodmap is used to store typed collections based on Dynamic methodmaps. Internally
    an ArrayList is used for storage. This methodmap can be inherited by your own methodmaps
    where you can override the Items method to return your custom methodmap type which MUST
    inherit a Dynamic methodmap.
    
    Please see '\scripting\dynamic\examples\collections\' for an example usage of this methodmap
*/

methodmap Collection ArrayList
{
    public 
Collection()
    {
        return 
view_as<Collection>(new ArrayList());
    }
    
    public 
void Clear(bool disposemembers=true)
    {
        if (
disposemembers)
        {
            
int count this.Length;
            
Dynamic member;
            for (
int i 0counti++)
            {
                
member view_as<Dynamic>(i);
                if (!
member.IsValid)
                    continue;
                    
                
member.Dispose();
            }
        }
        
        
this.Clear();
    }
    
    public 
void Dispose(bool disposemembers=true)
    {
        if (
disposemembers)
            
this.Clear(true);
        
        
CloseHandle(this);
    }
    
    public 
Dynamic Items(int index)
    {
        return 
this.Get(index);
    }
    
    
property int Count
    
{
        public 
get()
        {
            return 
this.Length;
        }
    }
    
    public 
int AddItem(Dynamic item)
    {
        
this.Push(item);
    }
    
    public 
int FindItem(Dynamic item)
    {
        
int count this.Length;
        for (
int i 0counti++)
        {
            if (
this.Get(i) == item)
                return 
i;
        }
        return -
1;
    }
    
    public 
void RemoveItem(Dynamic item)
    {
        
int index this.FindItem(item);
        if (
index == -1)
            return;
            
        
this.Erase(index);
    }
    
    public 
void RemoveIndex(int index)
    {
        
this.Erase(index);
    }
}
/**
 * =============================================================================
 * Dynamic for SourceMod (C)2016 Matthew J Dunn.   All rights reserved.
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
 
#if defined _dynamic_basic_included
 
 #endinput
#endif
#define _dynamic_basic_included

/*
    This methodmap is based on the Dynamic methodmap while using a StringMap methodmap
    for implementation. This methodmap doesn't implement the full features of the Dynamic
    methodmap (type conversion, object naming, plugin sharing, ect). This methodmap can
    be used for basic storage using the standard Dynamic methodmap Methods.
    
    Please see '\scripting\dynamic\examples\basic\' for an example usage of this methodmap
*/

methodmap Basic StringMap
{
    public 
Basic()
    {
        return new 
StringMap();
    }
    
    public 
void Dispose(bool disposemembers=true)
    {
        
delete this;
    }
    
    public 
int GetInt(const char[] membernameint defaultvalue=-1)
    {
        
int value;
        if (
this.GetValue(membernamevalue))
            return 
value;
        
        return 
defaultvalue;
    }
    
    public 
void SetInt(const char[] membernameint value)
    {
        
this.SetValue(membernamevalue);
    }
    
    public 
bool GetBool(const char[] membernamebool defaultvalue=false)
    {
        
bool value;
        if (
this.GetValue(membernamevalue))
            return 
value;
        
        return 
defaultvalue;
    }
    
    public 
void SetBool(const char[] membernamebool value)
    {
        
this.SetValue(membernamevalue);
    }
    
    public 
float GetFloat(const char[] membernamefloat defaultvalue=-1.0)
    {
        
float value;
        if (
this.GetValue(membernamevalue))
            return 
value;
        
        return 
defaultvalue;
    }
    
    public 
void SetFloat(const char[] membernamefloat value)
    {
        
this.SetValue(membernamevalue);
    }
    
    public 
bool GetString(const char[] membernamechar[] bufferint length)
    {
        return 
this.GetString(membernamebufferlength);
    }
    
    public 
void SetString(const char[] membername, const char[] value)
    {
        
this.SetString(membernamevalue);
    }
    
    public 
Dynamic GetObject(const char[] membername)
    {
        
Dynamic value;
        if (
this.GetValue(membernamevalue))
            return 
value;
        
        return 
INVALID_DYNAMIC_OBJECT;
    }
    
    public 
void SetObject(const char[] membernameDynamic value)
    {
        
this.SetValue(membernamevalue);
    }
    
    public 
Handle GetHandle(const char[] membername)
    {
        
Handle value;
        if (
this.GetValue(membernamevalue))
            return 
value;
        
        return 
null;
    }
    
    public 
void SetHandle(const char[] membernameHandle value)
    {
        
this.SetValue(membernamevalue);
    }
    
    public 
bool GetVector(const char[] membernamefloat[3vector)
    {
        return 
this.GetArray(membernamevectorsizeof(vector));
    }
    
    public 
void SetVector(const char[] membername, const float[3value)
    {
        
this.SetArray(membernamevaluesizeof(value));
    }
}
#if defined _chat_processor_included
 
 #endinput
#endif
#define _chat_processor_included

//Globals
#define MAXLENGTH_INPUT        128
#define MAXLENGTH_NAME        64
#define MAXLENGTH_MESSAGE    256

enum eChatFlags
{
    
ChatFlag_Invalid,
    
ChatFlag_All,
    
ChatFlag_Team,
    
ChatFlag_Spec,
    
ChatFlag_Dead
}

//Forwards
/**
* Called while sending a chat message before It's sent.
* Limits on the name and message strings can be found above.
*
* param author            Author that created the message.
* param recipients        Array of clients who will receive the message.
* param flag            Determines which type of message is being sent.
* param name            Name string of the author to be pushed.
* param message            Message string from the author to be pushed.
*
* return types
*  - Plugin_Continue    Stops the message.
*  - Plugin_Stop        Stops the message.
*  - Plugin_Changed        Fires the post-forward below and prints out a message.
*  - Plugin_Handled        Fires the post-forward below but doesn't print a message.
**/
forward Action OnChatMessage(intauthorArrayList recipientseChatFlagsflagchar[] namechar[] messageboolbProcessColorsboolbRemoveColors);

/**
* Called after the chat message is sent to the designated clients by the author.
*
* param author            Author that sent the message.
* param recipients        Array of clients who received the message.
* param flag            Determines which type of message was sent.
* param name            Name string of the author.
* param message            Message string from the author.
*
* noreturn
**/
forward void OnChatMessagePost(int authorArrayList recipientseChatFlags flag, const char[] name, const char[] messagebool bProcessColorsbool bRemoveColors);

/**
Shared plugin information
**/
public SharedPlugin _pl_chat_processor =
{
    
name "chat-processor",
    
file "chat-processor.smx",
#if defined REQUIRE_PLUGIN
    
required 1
#else
    
required 0
#endif
};
#if defined _SteamWorks_Included
 #endinput
#endif
#define _SteamWorks_Included

/* results from UserHasLicenseForApp */
enum EUserHasLicenseForAppResult
{
    
k_EUserHasLicenseResultHasLicense 0,                    // User has a license for specified app
    
k_EUserHasLicenseResultDoesNotHaveLicense 1,            // User does not have a license for the specified app
    
k_EUserHasLicenseResultNoAuth 2,                        // User has not been authenticated
};

/* General result codes */
enum EResult
{
    
k_EResultOK    1,                            // success
    
k_EResultFail 2,                            // generic failure 
    
k_EResultNoConnection 3,                    // no/failed network connection
//    k_EResultNoConnectionRetry = 4,                // OBSOLETE - removed
    
k_EResultInvalidPassword 5,                // password/ticket is invalid
    
k_EResultLoggedInElsewhere 6,                // same user logged in elsewhere
    
k_EResultInvalidProtocolVer 7,            // protocol version is incorrect
    
k_EResultInvalidParam 8,                    // a parameter is incorrect
    
k_EResultFileNotFound 9,                    // file was not found
    
k_EResultBusy 10,                            // called method busy - action not taken
    
k_EResultInvalidState 11,                    // called object was in an invalid state
    
k_EResultInvalidName 12,                    // name is invalid
    
k_EResultInvalidEmail 13,                    // email is invalid
    
k_EResultDuplicateName 14,                // name is not unique
    
k_EResultAccessDenied 15,                    // access is denied
    
k_EResultTimeout 16,                        // operation timed out
    
k_EResultBanned 17,                        // VAC2 banned
    
k_EResultAccountNotFound 18,                // account not found
    
k_EResultInvalidSteamID 19,                // steamID is invalid
    
k_EResultServiceUnavailable 20,            // The requested service is currently unavailable
    
k_EResultNotLoggedOn 21,                    // The user is not logged on
    
k_EResultPending 22,                        // Request is pending (may be in process, or waiting on third party)
    
k_EResultEncryptionFailure 23,            // Encryption or Decryption failed
    
k_EResultInsufficientPrivilege 24,        // Insufficient privilege
    
k_EResultLimitExceeded 25,                // Too much of a good thing
    
k_EResultRevoked 26,                        // Access has been revoked (used for revoked guest passes)
    
k_EResultExpired 27,                        // License/Guest pass the user is trying to access is expired
    
k_EResultAlreadyRedeemed 28,                // Guest pass has already been redeemed by account, cannot be acked again
    
k_EResultDuplicateRequest 29,                // The request is a duplicate and the action has already occurred in the past, ignored this time
    
k_EResultAlreadyOwned 30,                    // All the games in this guest pass redemption request are already owned by the user
    
k_EResultIPNotFound 31,                    // IP address not found
    
k_EResultPersistFailed 32,                // failed to write change to the data store
    
k_EResultLockingFailed 33,                // failed to acquire access lock for this operation
    
k_EResultLogonSessionReplaced 34,
    
k_EResultConnectFailed 35,
    
k_EResultHandshakeFailed 36,
    
k_EResultIOFailure 37,
    
k_EResultRemoteDisconnect 38,
    
k_EResultShoppingCartNotFound 39,            // failed to find the shopping cart requested
    
k_EResultBlocked 40,                        // a user didn't allow it
    
k_EResultIgnored 41,                        // target is ignoring sender
    
k_EResultNoMatch 42,                        // nothing matching the request found
    
k_EResultAccountDisabled 43,
    
k_EResultServiceReadOnly 44,                // this service is not accepting content changes right now
    
k_EResultAccountNotFeatured 45,            // account doesn't have value, so this feature isn't available
    
k_EResultAdministratorOK 46,                // allowed to take this action, but only because requester is admin
    
k_EResultContentVersion 47,                // A Version mismatch in content transmitted within the Steam protocol.
    
k_EResultTryAnotherCM 48,                    // The current CM can't service the user making a request, user should try another.
    
k_EResultPasswordRequiredToKickSession 49,// You are already logged in elsewhere, this cached credential login has failed.
    
k_EResultAlreadyLoggedInElsewhere 50,        // You are already logged in elsewhere, you must wait
    
k_EResultSuspended 51,                    // Long running operation (content download) suspended/paused
    
k_EResultCancelled 52,                    // Operation canceled (typically by user: content download)
    
k_EResultDataCorruption 53,                // Operation canceled because data is ill formed or unrecoverable
    
k_EResultDiskFull 54,                        // Operation canceled - not enough disk space.
    
k_EResultRemoteCallFailed 55,                // an remote call or IPC call failed
    
k_EResultPasswordUnset 56,                // Password could not be verified as it's unset server side
    
k_EResultExternalAccountUnlinked 57,        // External account (PSN, Facebook...) is not linked to a Steam account
    
k_EResultPSNTicketInvalid 58,                // PSN ticket was invalid
    
k_EResultExternalAccountAlreadyLinked 59,    // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
    
k_EResultRemoteFileConflict 60,            // The sync cannot resume due to a conflict between the local and remote files
    
k_EResultIllegalPassword 61,                // The requested new password is not legal
    
k_EResultSameAsPreviousValue 62,            // new value is the same as the old one ( secret question and answer )
    
k_EResultAccountLogonDenied 63,            // account login denied due to 2nd factor authentication failure
    
k_EResultCannotUseOldPassword 64,            // The requested new password is not legal
    
k_EResultInvalidLoginAuthCode 65,            // account login denied due to auth code invalid
    
k_EResultAccountLogonDeniedNoMail 66,        // account login denied due to 2nd factor auth failure - and no mail has been sent
    
k_EResultHardwareNotCapableOfIPT 67,        // 
    
k_EResultIPTInitError 68,                    // 
    
k_EResultParentalControlRestricted 69,    // operation failed due to parental control restrictions for current user
    
k_EResultFacebookQueryError 70,            // Facebook query returned an error
    
k_EResultExpiredLoginAuthCode 71,            // account login denied due to auth code expired
    
k_EResultIPLoginRestrictionFailed 72,
    
k_EResultAccountLockedDown 73,
    
k_EResultAccountLogonDeniedVerifiedEmailRequired 74,
    
k_EResultNoMatchingURL 75,
    
k_EResultBadResponse 76,                    // parse failure, missing field, etc.
    
k_EResultRequirePasswordReEntry 77,        // The user cannot complete the action until they re-enter their password
    
k_EResultValueOutOfRange 78,                // the value entered is outside the acceptable range
    
k_EResultUnexpectedError 79,                // something happened that we didn't expect to ever happen
    
k_EResultDisabled 80,                        // The requested service has been configured to be unavailable
    
k_EResultInvalidCEGSubmission 81,            // The set of files submitted to the CEG server are not valid !
    
k_EResultRestrictedDevice 82,                // The device being used is not allowed to perform this action
    
k_EResultRegionLocked 83,                    // The action could not be complete because it is region restricted
    
k_EResultRateLimitExceeded 84,            // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
    
k_EResultAccountLoginDeniedNeedTwoFactor 85,    // Need two-factor code to login
    
k_EResultItemDeleted 86,                    // The thing we're trying to access has been deleted
    
k_EResultAccountLoginDeniedThrottle 87,    // login attempt failed, try to throttle response to possible attacker
    
k_EResultTwoFactorCodeMismatch 88,        // two factor code mismatch
    
k_EResultTwoFactorActivationCodeMismatch 89,    // activation code for two-factor didn't match
    
k_EResultAccountAssociatedToMultiplePartners 90,    // account has been associated with multiple partners
    
k_EResultNotModified 91,                    // data not modified
    
k_EResultNoMobileDevice 92,                // the account does not have a mobile device associated with it
    
k_EResultTimeNotSynced 93,                // the time presented is out of range or tolerance
    
k_EResultSmsCodeFailed 94,                // SMS code failure (no match, none pending, etc.)
    
k_EResultAccountLimitExceeded 95,            // Too many accounts access this resource
    
k_EResultAccountActivityLimitExceeded 96,    // Too many changes to this account
    
k_EResultPhoneActivityLimitExceeded 97,    // Too many changes to this phone
    
k_EResultRefundToWallet 98,                // Cannot refund to payment method, must use wallet
    
k_EResultEmailSendFailure 99,                // Cannot send an email
    
k_EResultNotSettled 100,                    // Can't perform operation till payment has settled
    
k_EResultNeedCaptcha 101,                    // Needs to provide a valid captcha
    
k_EResultGSLTDenied 102,                    // a game server login token owned by this token's owner has been banned
    
k_EResultGSOwnerDenied 103,                // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
    
k_EResultInvalidItemType 104                // the type of thing we were requested to act on is invalid
};

/* This enum is used in client API methods, do not re-number existing values. */
enum EHTTPMethod
{
    
k_EHTTPMethodInvalid 0,
    
k_EHTTPMethodGET,
    
k_EHTTPMethodHEAD,
    
k_EHTTPMethodPOST,
    
k_EHTTPMethodPUT,
    
k_EHTTPMethodDELETE,
    
k_EHTTPMethodOPTIONS,

    
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for 
    // a compliant general purpose server.  We'll likely add more as we find uses for them.

    // k_EHTTPMethodTRACE,
    // k_EHTTPMethodCONNECT
};


/* HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions
 of each of these. */
enum EHTTPStatusCode
{
    
// Invalid status code (this isn't defined in HTTP, used to indicate unset in our code)
    
k_EHTTPStatusCodeInvalid =                    0,

    
// Informational codes
    
k_EHTTPStatusCode100Continue =                100,
    
k_EHTTPStatusCode101SwitchingProtocols =    101,

    
// Success codes
    
k_EHTTPStatusCode200OK =                    200,
    
k_EHTTPStatusCode201Created =                201,
    
k_EHTTPStatusCode202Accepted =                202,
    
k_EHTTPStatusCode203NonAuthoritative =        203,
    
k_EHTTPStatusCode204NoContent =                204,
    
k_EHTTPStatusCode205ResetContent =            205,
    
k_EHTTPStatusCode206PartialContent =        206,

    
// Redirection codes
    
k_EHTTPStatusCode300MultipleChoices =        300,
    
k_EHTTPStatusCode301MovedPermanently =        301,
    
k_EHTTPStatusCode302Found =                    302,
    
k_EHTTPStatusCode303SeeOther =                303,
    
k_EHTTPStatusCode304NotModified =            304,
    
k_EHTTPStatusCode305UseProxy =                305,
    
//k_EHTTPStatusCode306Unused =                306, (used in old HTTP spec, now unused in 1.1)
    
k_EHTTPStatusCode307TemporaryRedirect =        307,

    
// Error codes
    
k_EHTTPStatusCode400BadRequest =            400,
    
k_EHTTPStatusCode401Unauthorized =            401// You probably want 403 or something else. 401 implies you're sending a WWW-Authenticate header and the client can sent an Authorization header in response.
    
k_EHTTPStatusCode402PaymentRequired =        402// This is reserved for future HTTP specs, not really supported by clients
    
k_EHTTPStatusCode403Forbidden =                403,
    
k_EHTTPStatusCode404NotFound =                404,
    
k_EHTTPStatusCode405MethodNotAllowed =        405,
    
k_EHTTPStatusCode406NotAcceptable =            406,
    
k_EHTTPStatusCode407ProxyAuthRequired =        407,
    
k_EHTTPStatusCode408RequestTimeout =        408,
    
k_EHTTPStatusCode409Conflict =                409,
    
k_EHTTPStatusCode410Gone =                    410,
    
k_EHTTPStatusCode411LengthRequired =        411,
    
k_EHTTPStatusCode412PreconditionFailed =    412,
    
k_EHTTPStatusCode413RequestEntityTooLarge =    413,
    
k_EHTTPStatusCode414RequestURITooLong =        414,
    
k_EHTTPStatusCode415UnsupportedMediaType =    415,
    
k_EHTTPStatusCode416RequestedRangeNotSatisfiable 416,
    
k_EHTTPStatusCode417ExpectationFailed =        417,
    
k_EHTTPStatusCode4xxUnknown =                 418// 418 is reserved, so we'll use it to mean unknown
    
k_EHTTPStatusCode429TooManyRequests    =        429,

    
// Server error codes
    
k_EHTTPStatusCode500InternalServerError =    500,
    
k_EHTTPStatusCode501NotImplemented =        501,
    
k_EHTTPStatusCode502BadGateway =            502,
    
k_EHTTPStatusCode503ServiceUnavailable =    503,
    
k_EHTTPStatusCode504GatewayTimeout =        504,
    
k_EHTTPStatusCode505HTTPVersionNotSupported 505,
    
k_EHTTPStatusCode5xxUnknown =                599,
};

/* list of possible return values from the ISteamGameCoordinator API */
enum EGCResults
{
    
k_EGCResultOK 0,
    
k_EGCResultNoMessage 1,            // There is no message in the queue
    
k_EGCResultBufferTooSmall 2,        // The buffer is too small for the requested message
    
k_EGCResultNotLoggedOn 3,            // The client is not logged onto Steam
    
k_EGCResultInvalidMessage 4,        // Something was wrong with the message being sent with SendMessage
};

native bool:SteamWorks_IsVACEnabled();
native bool:SteamWorks_GetPublicIP(ipaddr[4]);
native SteamWorks_GetPublicIPCell();
native bool:SteamWorks_IsLoaded();
native bool:SteamWorks_SetGameDescription(String:sDesc[]);
native bool:SteamWorks_IsConnected();
native bool:SteamWorks_SetRule(const String:sKey[], const String:sValue[]);
native bool:SteamWorks_ClearRules();
native bool:SteamWorks_ForceHeartbeat();
native bool:SteamWorks_GetUserGroupStatus(clientgroupid);
native bool:SteamWorks_GetUserGroupStatusAuthID(authidgroupid);

native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForApp(clientapp);
native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForAppId(authidapp);
native SteamWorks_GetClientSteamID(clientString:sSteamID[], length);

native bool:SteamWorks_RequestStatsAuthID(authidappid);
native bool:SteamWorks_RequestStats(clientappid);
native bool:SteamWorks_GetStatCell(client, const String:sKey[], &value);
native bool:SteamWorks_GetStatAuthIDCell(authid, const String:sKey[], &value);
native bool:SteamWorks_GetStatFloat(client, const String:sKey[], &Float:value);
native bool:SteamWorks_GetStatAuthIDFloat(authid, const String:sKey[], &Float:value);

native Handle:SteamWorks_CreateHTTPRequest(EHTTPMethod:method, const String:sURL[]);
native bool:SteamWorks_SetHTTPRequestContextValue(Handle:hHandleany:data1any:data2=0);
native bool:SteamWorks_SetHTTPRequestNetworkActivityTimeout(Handle:hHandletimeout);
native bool:SteamWorks_SetHTTPRequestHeaderValue(Handle:hHandle, const String:sName[], const String:sValue[]);
native bool:SteamWorks_SetHTTPRequestGetOrPostParameter(Handle:hHandle, const String:sName[], const String:sValue[]);

funcenum SteamWorksHTTPRequestCompleted
{
    public(
Handle:hRequestbool:bFailurebool:bRequestSuccessfulEHTTPStatusCode:eStatusCode),
    public(
Handle:hRequestbool:bFailurebool:bRequestSuccessfulEHTTPStatusCode:eStatusCodeany:data1),
    public(
Handle:hRequestbool:bFailurebool:bRequestSuccessfulEHTTPStatusCode:eStatusCodeany:data1any:data2)
};

funcenum SteamWorksHTTPHeadersReceived
{
    public(
Handle:hRequestbool:bFailure),
    public(
Handle:hRequestbool:bFailureany:data1),
    public(
Handle:hRequestbool:bFailureany:data1any:data2)
};

funcenum SteamWorksHTTPDataReceived
{
    public(
Handle:hRequestbool:bFailureoffsetbytesreceived),
    public(
Handle:hRequestbool:bFailureoffsetbytesreceivedany:data1),
    public(
Handle:hRequestbool:bFailureoffsetbytesreceivedany:data1any:data2)
};

native bool:SteamWorks_SetHTTPCallbacks(Handle:hHandleSteamWorksHTTPRequestCompleted:fCompleted INVALID_FUNCTIONSteamWorksHTTPHeadersReceived:fHeaders INVALID_FUNCTIONSteamWorksHTTPDataReceived:fData INVALID_FUNCTIONHandle:hCalling INVALID_HANDLE);
native bool:SteamWorks_SendHTTPRequest(Handle:hRequest);
native bool:SteamWorks_SendHTTPRequestAndStreamResponse(Handle:hRequest);
native bool:SteamWorks_DeferHTTPRequest(Handle:hRequest);
native bool:SteamWorks_PrioritizeHTTPRequest(Handle:hRequest);
native bool:SteamWorks_GetHTTPResponseHeaderSize(Handle:hRequest, const String:sHeader[], &size);
native bool:SteamWorks_GetHTTPResponseHeaderValue(Handle:hRequest, const String:sHeader[], String:sValue[], size);
native bool:SteamWorks_GetHTTPResponseBodySize(Handle:hRequest, &size);
native bool:SteamWorks_GetHTTPResponseBodyData(Handle:hRequestString:sBody[], length);
native bool:SteamWorks_GetHTTPStreamingResponseBodyData(Handle:hRequestcOffsetString:sBody[], length);
native bool:SteamWorks_GetHTTPDownloadProgressPct(Handle:hRequest, &Float:percent);
native bool:SteamWorks_SetHTTPRequestRawPostBody(Handle:hRequest, const String:sContentType[], const String:sBody[], bodylen);

funcenum SteamWorksHTTPBodyCallback
{
    public(const 
String:sData[]),
    public(const 
String:sData[], any:value),
    public(const 
data[], any:valuedatalen)
};

native bool:SteamWorks_GetHTTPResponseBodyCallback(Handle:hRequestSteamWorksHTTPBodyCallback:fCallbackany:data 0Handle:hPlugin INVALID_HANDLE);
native bool:SteamWorks_WriteHTTPResponseBodyToFile(Handle:hRequest, const String:sFileName[]);

forward SW_OnValidateClient(ownerauthidauthid);
forward SteamWorks_OnValidateClient(ownerauthidauthid);
forward SteamWorks_SteamServersConnected();
forward SteamWorks_SteamServersConnectFailure(EResult:result);
forward SteamWorks_SteamServersDisconnected(EResult:result);

forward Action:SteamWorks_RestartRequested();
forward SteamWorks_TokenRequested(String:sToken[], maxlen);

forward SteamWorks_OnClientGroupStatus(authidgroupidbool:isMemberbool:isOfficer);

forward EGCResults:SteamWorks_GCSendMessage(unMsgType, const String:pubData[], cubData);
forward SteamWorks_GCMsgAvailable(cubData);
forward EGCResults:SteamWorks_GCRetrieveMessage(punMsgType, const String:pubDest[], cubDestpcubMsgSize);

native EGCResults:SteamWorks_SendMessageToGC(unMsgType, const String:pubData[], cubData);

public 
Extension:__ext_SteamWorks 
{
    
name "SteamWorks",
    
file "SteamWorks.ext",
#if defined AUTOLOAD_EXTENSIONS
    
autoload 1,
#else
    
autoload 0,
#endif
#if defined REQUIRE_EXTENSIONS
    
required 1,
#else
    
required 0,
#endif
};

#if !defined REQUIRE_EXTENSIONS
public __ext_SteamWorks_SetNTVOptional()
{
    
MarkNativeAsOptional("SteamWorks_IsVACEnabled");
    
MarkNativeAsOptional("SteamWorks_GetPublicIP");
    
MarkNativeAsOptional("SteamWorks_GetPublicIPCell");
    
MarkNativeAsOptional("SteamWorks_IsLoaded");
    
MarkNativeAsOptional("SteamWorks_SetGameDescription");
    
MarkNativeAsOptional("SteamWorks_IsConnected");
    
MarkNativeAsOptional("SteamWorks_SetRule");
    
MarkNativeAsOptional("SteamWorks_ClearRules");
    
MarkNativeAsOptional("SteamWorks_ForceHeartbeat");
    
MarkNativeAsOptional("SteamWorks_GetUserGroupStatus");
    
MarkNativeAsOptional("SteamWorks_GetUserGroupStatusAuthID");

    
MarkNativeAsOptional("SteamWorks_HasLicenseForApp");
    
MarkNativeAsOptional("SteamWorks_HasLicenseForAppId");
    
MarkNativeAsOptional("SteamWorks_GetClientSteamID");

    
MarkNativeAsOptional("SteamWorks_RequestStatsAuthID");
    
MarkNativeAsOptional("SteamWorks_RequestStats");
    
MarkNativeAsOptional("SteamWorks_GetStatCell");
    
MarkNativeAsOptional("SteamWorks_GetStatAuthIDCell");
    
MarkNativeAsOptional("SteamWorks_GetStatFloat");
    
MarkNativeAsOptional("SteamWorks_GetStatAuthIDFloat");

    
MarkNativeAsOptional("SteamWorks_SendMessageToGC");

    
MarkNativeAsOptional("SteamWorks_CreateHTTPRequest");
    
MarkNativeAsOptional("SteamWorks_SetHTTPRequestContextValue");
    
MarkNativeAsOptional("SteamWorks_SetHTTPRequestNetworkActivityTimeout");
    
MarkNativeAsOptional("SteamWorks_SetHTTPRequestHeaderValue");
    
MarkNativeAsOptional("SteamWorks_SetHTTPRequestGetOrPostParameter");

    
MarkNativeAsOptional("SteamWorks_SetHTTPCallbacks");
    
MarkNativeAsOptional("SteamWorks_SendHTTPRequest");
    
MarkNativeAsOptional("SteamWorks_SendHTTPRequestAndStreamResponse");
    
MarkNativeAsOptional("SteamWorks_DeferHTTPRequest");
    
MarkNativeAsOptional("SteamWorks_PrioritizeHTTPRequest");
    
MarkNativeAsOptional("SteamWorks_GetHTTPResponseHeaderSize");
    
MarkNativeAsOptional("SteamWorks_GetHTTPResponseHeaderValue");
    
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodySize");
    
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyData");
    
MarkNativeAsOptional("SteamWorks_GetHTTPStreamingResponseBodyData");
    
MarkNativeAsOptional("SteamWorks_GetHTTPDownloadProgressPct");
    
MarkNativeAsOptional("SteamWorks_SetHTTPRequestRawPostBody");

    
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyCallback");
    
MarkNativeAsOptional("SteamWorks_WriteHTTPResponseBodyToFile");
}
#endif

#pragma newdecls required
#pragma semicolon 1

#define SMDISCORD_VERSION "1.0"

ConVar hostname null;
char gS_WebhookURL[1024];

public 
Plugin myinfo =
{
    
name "SourceMod <-> Discord",
    
author "shavit",
    
description "Relays in-game chat into a Discord channel.",
    
version SMDISCORD_VERSION,
    
url "https://github.com/shavitush/smdiscord"
}

public 
void OnPluginStart()
{
    
hostname FindConVar("hostname");
    
CreateConVar("smdiscord_version"SMDISCORD_VERSION"Plugin version."FCVAR_NOTIFY|FCVAR_DONTRECORD);

    
char[] sError = new char[256];

    if(!
LoadConfig(sError256))
    {
        
SetFailState("Couldn't load the configuration file. Error: %s"sError);
    }
}

bool LoadConfig(char[] errorint maxlen)
{
    
char[] sPath = new char[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMsPathPLATFORM_MAX_PATH"configs/smdiscord.cfg");

    
Dynamic dConfigFile Dynamic();

    if(!
dConfigFile.ReadKeyValues(sPath))
    {
        
dConfigFile.Dispose();

        
FormatEx(errormaxlen"Couldn't access \"%s\". Make sure that the file exists and has correct permissions set."sPath);

        return 
false;
    }

    
dConfigFile.GetString("WebhookURL"gS_WebhookURL1024);

    if(
StrContains(gS_WebhookURL"https://discordapp.com/api/webhooks") == -1)
    {
        
FormatEx(errormaxlen"Please change the value of WebhookURL in the configuration file (\"%s\") to a valid URL. Current value is \"%s\"."sPathgS_WebhookURL);

        return 
false;
    }

    return 
true;
}

void EscapeString(char[] stringint maxlen)
{
    
ReplaceString(stringmaxlen"@""@");
    
ReplaceString(stringmaxlen"'""'");
    
ReplaceString(stringmaxlen"\"""\"");
}

public 
Action OnChatMessage(int &authorArrayList recipientseChatFlags &flagchar[] namechar[] messagebool &bProcessColorsbool &bRemoveColors)
{
    
char[] sHostname = new char[32];
    
hostname.GetString(sHostname32);
    
EscapeString(sHostname32);

    
char[] sFormat = new char[1024];
    
FormatEx(sFormat1024"{\"username\":\"%s\", \"content\":\"{message}\"}"sHostname);
    
    
char[] sAuthID = new char[32];
    
GetClientAuthId(authorAuthId_Steam3sAuthID32);

    
char[] sTime = new char[8];
    
FormatTime(sTime8"%H:%I");

    
char[] sNewMessage = new char[1024];
    
FormatEx(sNewMessage1024"%s | %s - %s: %s"sTimesAuthIDnamemessage);
    
EscapeString(sNewMessage1024);
    
ReplaceString(sFormat1024"{message}"sNewMessage);

    
PrintToServer("%s"sFormat);

    
Handle hRequest SteamWorks_CreateHTTPRequest(k_EHTTPMethodPOSTgS_WebhookURL);
    
SteamWorks_SetHTTPRequestRawPostBody(hRequest"application/json"sFormatstrlen(sFormat));
    
SteamWorks_SetHTTPCallbacks(hRequestview_as<SteamWorksHTTPRequestCompleted>(OnRequestComplete));
    
SteamWorks_SendHTTPRequest(hRequest);

    return 
Plugin_Continue;
}

public 
void OnRequestComplete(Handle hRequestbool bFailedbool bRequestSuccessfulEHTTPStatusCode eStatusCode)
{
    
delete hRequest;




- Web Site Yazılımı
- Kontrol Panel Yazılımı
- Otomasyon Sistemleri
#3
Çok sağolasın. İstersen ücretli eklenti satın alabilirim. Projelerim var özelden konuşalım.



not2easy Steam Grubu'na katılarak topluluğumuza destekde bulunabilirsiniz.
#4
[Resim: screenshot_2018-07-06-15-03-09-png.12]

Bu sekilde mesajları 3 kez gönderiyor.  Resmin üstündeki gibi mesajları göndermesi için düzenler misiniz?



not2easy Steam Grubu'na katılarak topluluğumuza destekde bulunabilirsiniz.
#5
Son Düzenleme: 24-05-2019, Saat: 04:10, Düzenleyen: alphaearth.
Yukardaki paylaştığınız kodlar çalışmıyordu. Bu eklenti tarafımdan denendi ve sorunsuz çalışıyor.
 
Konuyu çözülmüş isterlere taşır mısınız?


.zip DC-Chat_Aktar.zip (Dosya Boyutu: 17.48 KB | İndirme Sayısı: 2)

not2easy Steam Grubu'na katılarak topluluğumuza destekde bulunabilirsiniz.


Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Task