#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
new String:g_TModel[PLATFORM_MAX_PATH] = {"models/player/kuristaja/duke/duke.mdl"};
new String:g_TArms[PLATFORM_MAX_PATH] = {"models/player/kuristaja/duke/duke_arms.mdl"};
new String:g_CTModel[PLATFORM_MAX_PATH] = {"models/player/kuristaja/duke/duke.mdl"};
new String:g_CTArms[PLATFORM_MAX_PATH] = {"models/player/kuristaja/duke/duke_arms.mdl"};
public Plugin:myinfo =
{
name = "CS:GO Custom Skins",
author = "LeXuS",
description = "Automatically sets the admins skin.",
version = "1.0",
url = "http://hlmod.ru/forum/plaginy-dlya-sourcemod/27366-cs-go-skins-v1-0-a.html"
};
public OnPluginStart() HookEvent("player_spawn", Player_Spawn);
public OnMapStart()
{
new Handle:file = OpenFile("addons/sourcemod/configs/sm_custom_skins/downloads.txt", "r");
if(file == INVALID_HANDLE) SetFailState("Failed to open addons/sourcemod/configs/sm_custom_skins/downloads.txt");
decl String:path[PLATFORM_MAX_PATH];
while(!IsEndOfFile(file) && ReadFileLine(file, path, PLATFORM_MAX_PATH))
{
TrimString(path);
if(IsCharAlpha(path[0])) AddFileToDownloadsTable(path);
}
CloseHandle(file);
PrecacheModel(g_TModel, true);
if(g_TArms[0]) PrecacheModel(g_TArms, true);
PrecacheModel(g_CTModel, true);
if(g_CTArms[0]) PrecacheModel(g_CTArms, true);
}
public Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new team = GetClientTeam(client);
switch (team)
{
case 2:
{
SetEntityModel(client, g_TModel);
if(g_TArms[0]) SetEntPropString(client, Prop_Send, "m_szArmsModel", g_TArms);
}
case 3:
{
SetEntityModel(client, g_CTModel);
if(g_CTArms[0]) SetEntPropString(client, Prop_Send, "m_szArmsModel", g_CTArms);
}
}
}