PDA

View Full Version : [req] change skin when knifed


radiofanat
01-02-2012, 19:18
Plugin must give a custom skin to attacker and another custom skin to victim, play a custom sound, and say in chat who knifed whom. Idea is to see in next round who was knifed and who is the knifer.
Sorry for my bad english.

Mitchell
01-03-2012, 11:34
does it have to be a skin? i mean im trying to save you here, it could be a floating sprite about a players head..

radiofanat
01-03-2012, 12:07
does it have to be a skin? i mean im trying to save you here, it could be a floating sprite about a players head..
Yes a skin, not a sprite or hat.

radiofanat
01-03-2012, 18:15
Found this plugin, it make half of job, change skin to victim, but i need to change on atacker too.

#include <sourcemod>
#include <sdktools_functions>
#include <sdktools_stringtables>

new String:wS_SkinRed[75], String:wS_SkinBlu[75], wS_hp, bool:wS_msg, bool:wS_SetSkinStatus[MAXPLAYERS+1];

public OnPluginStart()
{
CreateConVar("wS_kKill_hp", "25");
CreateConVar("wS_kSkinRed", "models/player/techknow/squak/squak.mdl");
CreateConVar("wS_kSkinBlu", "models/player/techknow/frat/frat.mdl");
CreateConVar("wS_kSkinMsg", "1");

RegServerCmd("wS_DownLoad", wS_DownLoad);
HookEvent("player_death", wS_Player_Death);
HookEvent("player_spawn", wS_Player_Spawn);
wS_load();
}

public OnMapStart()
{
wS_load();
}

wS_load()
{
if (!FileExists("cfg/wS_Knife_Bonus.cfg"))
{
LogMessage("cfg/wS_Knife_Bonus.cfg НЕ НАЙДЕН");
return;
}
ServerCommand("exec wS_Knife_Bonus.cfg");
wS_hp = GetConVarInt(FindConVar("wS_kKill_hp"));

if (GetConVarInt(FindConVar("wS_kSkinMsg")) == 1) wS_msg = true;
else wS_msg = false;

GetConVarString(FindConVar("wS_kSkinRed"), wS_SkinRed, sizeof(wS_SkinRed));
if (strlen(wS_SkinRed) > 5 && StrContains(wS_SkinRed, ".mdl") != -1) TrimString(wS_SkinRed);
else wS_SkinRed = "";

GetConVarString(FindConVar("wS_kSkinBlu"), wS_SkinBlu, sizeof(wS_SkinBlu));
if (strlen(wS_SkinBlu) > 5 && StrContains(wS_SkinBlu, ".mdl") != -1) TrimString(wS_SkinBlu);
else wS_SkinBlu = "";
}

public wS_Player_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:wS_weapon[25];
GetEventString(event, "weapon", wS_weapon, sizeof(wS_weapon));
if (StrEqual(wS_weapon, "knife", false))
{
new a = GetClientOfUserId(GetEventInt(event, "attacker"));
new i = GetClientOfUserId(GetEventInt(event, "userid"));
if (a > 0 && GetClientTeam(a) != GetClientTeam(i))
{
if (wS_hp > 0) SetEntProp(a, Prop_Send, "m_iHealth", GetClientHealth(a) + wS_hp);
wS_SetSkinStatus[i] = true;
}
}
}

public wS_Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new i = GetClientOfUserId(GetEventInt(event, "userid"));
if (wS_SetSkinStatus[i])
{
new t = GetClientTeam(i);
if (t == 2) wS_SetSkin(i, wS_SkinRed);
else if (t == 3) wS_SetSkin(i, wS_SkinBlu);
wS_SetSkinStatus[i] = false;
}
}

wS_SetSkin(i, const String:skin[])
{
if (strlen(skin) > 5)
{
if (!IsModelPrecached(skin)) PrecacheModel(skin, true);
SetEntityModel(i, skin);
if (wS_msg) PrintToChatAll("\x01Игроку \x04%N \x03установлен \x01новый скин", i);
}
}

public OnClientPutInServer(i)
{
wS_SetSkinStatus[i] = false;
}

public Action:wS_DownLoad(args)
{
if (args == 1)
{
decl String:wS_str[75];
GetCmdArg(1, wS_str, sizeof(wS_str));
TrimString(wS_str);
AddFileToDownloadsTable(wS_str);
}
return Plugin_Handled;
}

// World-Source.Ru - Скрипты для Сервера CS Source на Заказ