View Single Post
Static2601
Senior Member
Join Date: Jun 2010
Old 04-27-2012 , 06:46   Re: how would I write this plugin?
Reply With Quote #8

If you saved it with the same name, I'm pretty sure players would get a map differs error. But I tried the code and works great. Im wondering if its ok to run that code multiple times, eg. Im also getting an "Unknown Command" when i enter the command, though it still works.
Code:
/* Plugin Template generated by Pawn Studio */

#include <sourcemod>
#include <sdktools>

public Plugin:myinfo = 
{
    name = "New Plugin",
    author = "Unknown",
    description = "<- Description ->",
    version = "1.0",
    url = "<- URL ->"
}

public OnPluginStart()
{
    RegAdminCmd("sm_bm_on", Command_One, ADMFLAG_SLAY, "");
    RegAdminCmd("sm_bm_off", Command_Two, ADMFLAG_SLAY, "");
    RegAdminCmd("sm_rm_on", Command_Three, ADMFLAG_SLAY, "");
    RegAdminCmd("sm_rm_off", Command_Four, ADMFLAG_SLAY, "");
}

public Action:Command_One(client, args)
{
    new entity = -1;
    while ((entity = FindEntityByClassname(entity, "logic_branch"))!=INVALID_ENT_REFERENCE)
    {
        new String:entName[MAX_NAME_LENGTH];
        GetEntPropString(entity, Prop_Data, "m_iName", entName, sizeof(entName));
        if(StrEqual(entName, "bsm"))
        {
            SetVariantInt(1);
            AcceptEntityInput(entity, "SetValueTest");
            break;
        }
    }
}

public Action:Command_Two(client, args)
{
    new entity = -1;
    while ((entity = FindEntityByClassname(entity, "logic_branch"))!=INVALID_ENT_REFERENCE)
    {
        new String:entName[MAX_NAME_LENGTH];
        GetEntPropString(entity, Prop_Data, "m_iName", entName, sizeof(entName));
        if(StrEqual(entName, "bsm"))
        {
            SetVariantInt(0);
            AcceptEntityInput(entity, "SetValueTest");
            break;
        }
    }
}

public Action:Command_Three(client, args)
{
    new entity = -1;
    while ((entity = FindEntityByClassname(entity, "logic_branch"))!=INVALID_ENT_REFERENCE)
    {
        new String:entName[MAX_NAME_LENGTH];
        GetEntPropString(entity, Prop_Data, "m_iName", entName, sizeof(entName));
        if(StrEqual(entName, "rsm"))
        {
            SetVariantInt(1);
            AcceptEntityInput(entity, "SetValueTest");
            break;
        }
    }
}

public Action:Command_Four(client, args)
{
    new entity = -1;
    while ((entity = FindEntityByClassname(entity, "logic_branch"))!=INVALID_ENT_REFERENCE)
    {
        new String:entName[MAX_NAME_LENGTH];
        GetEntPropString(entity, Prop_Data, "m_iName", entName, sizeof(entName));
        if(StrEqual(entName, "rsm"))
        {
            SetVariantInt(0);
            AcceptEntityInput(entity, "SetValueTest");
            break;
        }
    }
}
Static2601 is offline