Raised This Month: $32 Target: $400
 8% 

Help edit plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dr leks
Junior Member
Join Date: Jul 2013
Old 01-21-2014 , 12:17   Help edit plugin
Reply With Quote #1

Hello! Please accept my apologies for my english
Could you help me with this plugin
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

new String:current_map[55];

public Plugin:myinfo =
{
    name = "[L4D2] Model Select",
    author = "Accelerator",
    description = "Select model Player",
    version = "1.4",
    url = ""
};

public OnPluginStart()
{
    RegConsoleCmd("sm_rochelle", Command_model);
    RegConsoleCmd("sm_coach", Command_model);
    RegConsoleCmd("sm_nick", Command_model);
    RegConsoleCmd("sm_ellis", Command_model);
    RegConsoleCmd("sm_zoey", Command_model);
    RegConsoleCmd("sm_francis", Command_model);
    RegConsoleCmd("sm_louis", Command_model);
    RegConsoleCmd("sm_bill", Command_model);
}

public OnMapStart()
{
    GetCurrentMap(current_map, sizeof(current_map));
    
    CheckPrecacheModel("models/survivors/survivor_gambler.mdl");
    CheckPrecacheModel("models/survivors/survivor_manager.mdl");
    CheckPrecacheModel("models/survivors/survivor_coach.mdl");
    CheckPrecacheModel("models/survivors/survivor_producer.mdl");
    CheckPrecacheModel("models/survivors/survivor_teenangst.mdl");
    CheckPrecacheModel("models/survivors/survivor_biker.mdl");
    CheckPrecacheModel("models/survivors/survivor_namvet.mdl");
    CheckPrecacheModel("models/survivors/survivor_mechanic.mdl");
}

public Action:Command_model(client, args)
{
    if (!client || !IsClientInGame(client))
        return Plugin_Continue;

    decl String:model[256];
    GetCmdArg(0, model, sizeof(model));
    
    ReplaceString(model, sizeof(model), "sm_", "", false);

    if (client)
    {
        if (GetClientTeam(client) == 2)
        {            
            if (L4DMaps() == 2)
            {
                if (StrEqual(model, "nick"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 0);
                    SetEntityModel(client, "models/survivors/survivor_gambler.mdl");
                }
                else if (StrEqual(model, "rochelle"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 1);
                    SetEntityModel(client, "models/survivors/survivor_producer.mdl");
                }
                else if (StrEqual(model, "coach"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 2);
                    SetEntityModel(client, "models/survivors/survivor_coach.mdl");
                }
                else if (StrEqual(model, "ellis"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 3);
                    SetEntityModel(client, "models/survivors/survivor_mechanic.mdl");
                }
                else
                {
                    PrintToChat(client, "\x05Changing the skin \x04%s\x05 on this map disabled", model);
                    return Plugin_Continue;
                }
            }
            else if (L4DMaps() == 1)
            {
                if (StrEqual(model, "bill"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 0);
                    SetEntityModel(client, "models/survivors/survivor_namvet.mdl");
                }
                else if (StrEqual(model, "zoey"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 1);
                    SetEntityModel(client, "models/survivors/survivor_teenangst.mdl");
                }
                else if (StrEqual(model, "louis"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 2);
                    SetEntityModel(client, "models/survivors/survivor_manager.mdl");
                }
                else if (StrEqual(model, "francis"))
                {
                    SetEntProp(client, Prop_Send, "m_survivorCharacter", 3);
                    SetEntityModel(client, "models/survivors/survivor_biker.mdl");
                }
                else
                {
                    PrintToChat(client, "\x05Changing the skin \x04%s\x05 on this map disabled", model);
                    return Plugin_Continue;
                }
            }
            else
            {
                PrintToChat(client, "\x05Changing the skin \x04%s\x05 on this map disabled", model);
                return Plugin_Continue;
            }
            
            PrintToChat(client, "\x05Current skin is replaced by the skin \x04%s", model);
        }
    }
    return Plugin_Continue;
}

L4DMaps()
{
    if ((StrContains(current_map, "c7m") != -1) || (StrContains(current_map, "c8m") != -1) || (StrContains(current_map, "c9m") != -1) || (StrContains(current_map, "c10m") != -1) || (StrContains(current_map, "c11m") != -1) || (StrContains(current_map, "c12m", false) != -1)) 
        return 1;
        
    if ((StrContains(current_map, "c1m") != -1) || (StrContains(current_map, "c2m") != -1) || (StrContains(current_map, "c3m") != -1) || (StrContains(current_map, "c4m") != -1) || (StrContains(current_map, "c5m") != -1) || (StrContains(current_map, "c6m", false) != -1) || (StrContains(current_map, "c13m", false) != -1)) 
        return 2;
    
    return 0;
}

public CheckPrecacheModel(String:Model[])
{
    if (!IsModelPrecached(Model)) 
    {
        PrecacheModel(Model);
    }
}
How to get him to maintain throughout the game on the server that I select a character?

Last edited by dr leks; 01-21-2014 at 12:18.
dr leks is offline
Reply


Thread Tools
Display Modes

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 09:25.


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