Hi,
I'm looking for advices on plugin code i made with help of people from alliedmodders discord.
This plugin is supposed to change all player models to custom skin model (full white) and color it to either red or blue depending on the team they chose.
SetEntityRenderColor works as it should but it doesnt replace skin model with the one ive choosen.
CODE:
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>
public Plugin myinfo = {
name = "Player Models Color",
author = "EnteX",
description = "Gives a player complete white skin model and give it a red/blue tint",
version = "2.1.3.7",
url = ""
};
public void OnPluginStart()
{
for (int i=1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i))
ColorByTeam(i);
}
PrecacheModel("models/player/custom_player/Cosmic Surf/accelero_04_v3_backwards.mdl");
HookEvent("player_spawn", OnPlayerSpawn);
}
Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (client)
ColorByTeam(client);
}
void ColorByTeam(int client)
{
int team = GetClientTeam(client);
if (team == CS_TEAM_T)
SetEntityRenderColor(client, 255, 0, 0);
else if (team == CS_TEAM_CT)
SetEntityRenderColor(client, 255, 0, 8);
if (team == CS_TEAM_T)
SetEntityModel(client, "models/player/custom_player/Cosmic Surf/accelero_04_v3_backwards.mdl"); //T model
else if (team == CS_TEAM_CT)
SetEntityModel(client, "models/player/custom_player/Cosmic Surf/accelero_04_v3_backwards.mdl"); //CT
}