Jump to content

PTaH - V1.1.3


Recommended Posts

include

 

Пример/Тестовый плагин

Пример/Тестовый плагин

#pragma semicolon 1
#include <PTaH>

public void OnPluginStart() 
{
    PTaH(PTaH_ExecuteStringCommand, Hook, ExecuteStringCommand);
    PTaH(PTaH_OnClientConnect, Hook, OnClientConnectPre);
    PTaH(PTaH_GiveNamedItemPre, Hook, GiveNamedItemPre);
    PTaH(PTaH_MapContentList, Hook, MapContentList);
    PTaH(PTaH_WeaponCanUse, Hook, WeaponCanUse);
    PTaH(PTaH_ConsolePrint, Hook, ConsolePrint);
    PTaH(PTaH_SetPlayerModel, Hook, SetPlayerModel);
    PTaH(PTaH_ServerConsolePrint, Hook, ServerConsolePrint);
    RegConsoleCmd("ptah", ptah_);
    RegConsoleCmd("ptah2", ptah_2); 
}

   
public Action ptah_(int iClient, int args)
{
    char buf[64];
   
    AddrInfo addr;
    int res = PTaH_GetAddrInfo("forums.alliedmods.net", AF_UNSPEC, addr);
    if(res == 0)
    {
        PrintToChatAll("GetAddrInfo - forums.alliedmods.net");
        AddrInfo p;
        for(p = addr; p; p = p.NextIP)
        {
            p.GetIP(buf, sizeof(buf));
            PrintToChatAll("%s %s", p.Family == 2 ? "IP":"IP6", buf);
        }
        addr.ClearMem();
    }
    else
    {
        PTaH_Gai_StrError(res, buf, sizeof(buf));
        PrintToChatAll("GetAddrInfo - %d %s", res, buf);
    }
   
    PTaH_MD5File("addons/metamod.vdf", buf, sizeof(buf));
    PrintToChatAll("HASH - addons/metamod.vdf - %s", buf);
    return Plugin_Handled;
}

public Action ptah_2(int iClient, int args) 
{
    char sBuf[32];
    GetCmdArgString(sBuf, sizeof(sBuf));
    float origin[3];
    GetClientAbsOrigin(iClient, origin);
    int iEnt = PTaH_SpawnItemFromDefIndex(StringToInt(sBuf), origin);
    PrintToChat(iClient, "%d", iEnt);
}

public Action ExecuteStringCommand(int iClient, char sMessage[512])
{
    //Blocking command status
    static char sMessage2[512];
    sMessage2 = sMessage;
    //Remove space and tabs (commands its passed in the original form without a slew of front space and tab and etc) "           status   "
    TrimString(sMessage2); 
    //*Client could write "status 3453 4534 5456 2354"
    if(StrContains(sMessage2, "status") == 0)
    {
        PrintToChatAll("%N Introduced command status", iClient);
        return Plugin_Handled;
    }
    return Plugin_Continue;
}

public Action OnClientConnectPre(const char[] sName, char sPassword[128], const char[] sIp, const char[] sSteamID, char rejectReason[512])
{
    LogMessage("OnClientConnectPre %s %s %s", sName, sIp, sSteamID);
    return Plugin_Continue;
}

//We are doing the same thing as https://forums.alliedmods.net/showthread.php?t=236199 (do not forget say thank you to Dr!fter)
public Action GiveNamedItemPre(int iClient, char sClassname[64], CEconItemView &Item)
{
    if(!Item || !Item.IsCustomItemView())
    {
        CEconItemDefinition ItemDefinition = PTaH_GetItemDefinitionByName(sClassname);
        if(ItemDefinition)
        {
            int iTeam = GetClientTeam(iClient);
            int iLoadoutSlot = ItemDefinition.GetLoadoutSlot();
            CEconItemView Item2 = PTaH_GetItemInLoadout(iClient, iTeam, iLoadoutSlot);
            if(!Item2.IsCustomItemView())
            {
                Item2 = PTaH_GetItemInLoadout(iClient, iTeam == 2 ? 3:2, iLoadoutSlot);
                //                                    Fix the problem when its gave tec9 instead five-seven
                if(Item2.IsCustomItemView() && ItemDefinition.GetDefinitionIndex() == Item2.GetItemDefinition().GetDefinitionIndex())
                {
                    Item = Item2;
                    return Plugin_Changed;
                }
            }
        }
    }
    return Plugin_Continue;
}

//Blocking loading .nav files
public Action MapContentList(char sFile[128])
{
    if(StrContains(sFile, ".nav") != -1) return Plugin_Handled;
    return Plugin_Continue;
}

//Allowing Counter-terrorist pick up C4
public bool WeaponCanUse(int iClient, int iEnt, bool CanUse)
{
    static char sClassname[64];
    GetEdictClassname(iEnt, sClassname, sizeof(sClassname));
    if(StrEqual(sClassname, "weapon_c4")) return true;
    return CanUse;
}

//Withdraw in the chat client that writes to the console
public Action ConsolePrint(int iClient, char sMessage[1024])
{
    PrintToChat(iClient, sMessage);
    return Plugin_Continue;
}

public void SetPlayerModel(int iClient, const char[] sModel)
{
    PrintToChatAll("%N Set Model %s", iClient, sModel);
}

//Block out messages that contain DataTable warning
public Action ServerConsolePrint(const char[] sMessage, LoggingSeverity severity)
{
    if (StrContains(sMessage, "DataTable warning") != -1) return Plugin_Handled;
    return Plugin_Continue;
}

 

 

Ссылки
Source
Builds
Gamedata

ip9.gif

Link to comment
  • 2 weeks later...

L 11/19/2016 - 19:12:19: [SM] Unable to load extension "PTaH.ext": /host/19144/24381/csgo/addons/sourcemod/extensions/PTaH.ext.so: cannot open shared object file: No such file or directory

 

 

вот что пишет

Link to comment
В 19.11.2016 в 12:34, Sapsan сказал:

 

 

L 11/19/2016 - 19:12:19: [SM] Unable to load extension "PTaH.ext": /host/19144/24381/csgo/addons/sourcemod/extensions/PTaH.ext.so: cannot open shared object file: No such file or directory

 

вот что пишет

 

Открой билды и скачай последнюю версию.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...