Junior Member
|
07-17-2021
, 12:56
Re: Looking for model changing for every class in CT and TT
|
#3
|
Quote:
Originally Posted by Napoleon_be
I made something a while ago, but couldn't cba publishing it.
PHP Code:
/* Credits to
ConnorMcLeod:
- I got the Free For All code from his plugin: https://forums.alliedmods.net/showthread.php?t=80208
Bugsy:
- Helping me figure out how to set model to the player if the weapon can be bought by both teams.
- I still need to work on blocking weapon pickup to avoid bugs.
*/
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#pragma semicolon 1
#define PLUGIN "FFA: WeaponBased PlayerModels"
#define VERSION "1.0.0"
#define AUTHOR "NapoleoN#"
enum _:ModelsInfo
{
szModelName[32],
iWeaponID,
CsTeams:csTeams
}
new const szWeapons[][ModelsInfo] =
{
{ "wbknife", CSW_KNIFE , CS_TEAM_UNASSIGNED }, // Knife
{ "wbawp", CSW_AWP , CS_TEAM_UNASSIGNED }, // AWP
{ "wbfamas", CSW_FAMAS, CS_TEAM_CT }, // Famas
{ "wbm4a1", CSW_M4A1, CS_TEAM_CT }, // M4A1
{ "wbak47", CSW_AK47, CS_TEAM_T }, // AK47
{ "wbgalil", CSW_GALIL, CS_TEAM_T }, // Galil
{ "wbtmp", CSW_TMP, CS_TEAM_CT }, // TMP
{ "wbump45", CSW_UMP45 , CS_TEAM_UNASSIGNED}, // Ump45
{ "wbscout", CSW_SCOUT , CS_TEAM_UNASSIGNED}, // Scout
{ "wbxm1014", CSW_XM1014 , CS_TEAM_UNASSIGNED}, // XM1014
{ "wbaug", CSW_AUG, CS_TEAM_CT }, // AUG
{ "wbsg550", CSW_SG550, CS_TEAM_CT }, // SG550
{ "wbmp5navy", CSW_MP5NAVY , CS_TEAM_UNASSIGNED}, // MP5 Navy
{ "wbm249", CSW_M249 , CS_TEAM_UNASSIGNED}, // M249
{ "wbm3", CSW_M3 , CS_TEAM_UNASSIGNED}, // M3
{ "wbg3sg1", CSW_G3SG1, CS_TEAM_T }, // G3SG1
{ "wbsg552", CSW_SG552, CS_TEAM_T } // SG552
};
new iMsgRadar;
new iMaxPlayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("CurWeapon", "CheckWeapons", "be", "1=1");
RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage");
RegisterHam(Ham_TraceAttack, "player", "TraceAttack");
iMsgRadar = get_user_msgid("Radar");
register_message(iMsgRadar, "RadarMessage");
server_cmd("mp_friendlyfire 1");
iMaxPlayers = get_maxplayers();
}
precache_player_model(szModel[])
{
static szFile[128];
formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", szModel, szModel);
precache_model(szFile);
replace(szFile, charsmax(szFile), ".mdl", "T.mdl");
if(file_exists(szFile))
{
precache_model(szFile);
}
}
public plugin_precache()
{
for(new i; i < sizeof(szWeapons); i++)
{
precache_player_model(szWeapons[i][szModelName]);
}
}
public client_putinserver(id)
{
client_cmd(id, "hideradar");
}
public RadarMessage(iMsgID, MsgDest, id)
{
return PLUGIN_HANDLED;
}
public CheckWeapons(id)
{
new iUserWeapon = get_user_weapon(id);
new CsTeams:csTeam = cs_get_user_team(id);
for (new i; i < sizeof(szWeapons) ; i++)
{
if (iUserWeapon == szWeapons[i][iWeaponID])
{
if((szWeapons[i][csTeams] == CS_TEAM_UNASSIGNED) || (csTeam == szWeapons[i][csTeams]))
{
cs_set_user_model(id , szWeapons[i][szModelName]);
}
else
{
cs_reset_user_model(id);
}
break;
}
}
}
public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, DamageBits)
{
if(iVictim != iAttacker && (1 <= iAttacker <= iMaxPlayers))
{
new CsTeams:csVictimTeam = cs_get_user_team(iVictim);
if(csVictimTeam == cs_get_user_team(iAttacker))
{
cs_set_user_team(iVictim, csVictimTeam == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T);
ExecuteHamB(Ham_TakeDamage, iVictim, iInflictor, iAttacker, fDamage, DamageBits);
cs_set_user_team(iVictim, csVictimTeam);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public TraceAttack(iVictim, iAttacker, Float:fDamage, Float:fDirection[3], TraceHandle, DamageBits)
{
if( iVictim != iAttacker && (1 <= iAttacker <= iMaxPlayers))
{
new CsTeams:csVictimTeam = cs_get_user_team(iVictim);
if(csVictimTeam == cs_get_user_team(iAttacker))
{
cs_set_user_team(iVictim, csVictimTeam == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T);
ExecuteHamB(Ham_TraceAttack, iVictim, iAttacker, fDamage, fDirection, TraceHandle, DamageBits);
cs_set_user_team(iVictim, csVictimTeam);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
This basicly gives everyone a model according to their weapon. I made it "Free For All" based since it are all different models.
|
hi im looking something to change models for every class.
If he is in tt picks guerilla he will get replaced for it.
so basicly it will work like 4 skins to replace default skins.
i've seen plugins but they give u based on team 1 skin
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_init() {
register_plugin("AMX VIP Model", "1.1.1", "nylemustafa")
register_event("ResetHUD", "resetModel", "b")
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_model("models/player/admin_vip/admin_vip.mdl")
precache_model("models/player/admin_vip/admin_vip.mdl")
return PLUGIN_CONTINUE
}
public resetModel(id, level, cid) {
if (get_user_flags(id) & ADMIN_LEVEL_H) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
cs_set_user_model(id, "admin_vip")
}
else if(userTeam == CS_TEAM_CT) {
cs_set_user_model(id, "admin_vip")
}
else {
cs_reset_user_model(id)
}
}
return PLUGIN_CONTINUE
}
|
|