Raised This Month: $ Target: $400
 0% 

Added player skins with different flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
impossible89
Member
Join Date: Jun 2020
Old 12-25-2023 , 03:40   Added player skins with different flag
Reply With Quote #1

Hello, would it be possible to make a plugin to adjust the skins

An example:

;Flag - "m" - Prefix [Head Admin] // to have option to insert T and CT model

;Flag - "o" - Prefix [Global Admin] // to have option to insert T and CT model

;Flag - "q" - Prefix [Server Admin] // to have option to insert T and CT model

;Flag - "s" - Prefix [VIP] // to have option to insert T and CT model

;Flag - "r" - Prefix [Girl Admin] // to have option to insert T and CT model
impossible89 is offline
Tote
Senior Member
Join Date: Jul 2023
Old 12-25-2023 , 07:50   Re: Added player skins with different flag
Reply With Quote #2

Edit this code As you want and add the skins same like added owner/admin..

Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

enum _:ModelsInfo
{
	Flag,
	CTModel[32],
	TModel[32]
}

// SETTINGS HERE
new const g_eModels[][ModelsInfo] =
{
	{ ADMIN_LEVEL_A, "owner_ct", "owner_t" },
	{ ADMIN_LEVEL_B, "admin_ct", "admin_t" }
}
// END OF SETTINGS

new Trie:g_tModels

public plugin_init()
{
	register_plugin("Multiple Player Models", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
}

public plugin_end()
	TrieDestroy(g_tModels)

public plugin_precache()
{
	g_tModels = TrieCreate()
	
	for(new i; i < sizeof(g_eModels); i++)
	{
		precache_player_model(g_eModels[i][CTModel])
		precache_player_model(g_eModels[i][TModel])
	}
}

public OnPlayerSpawn(id)
{
	if(is_user_alive(id))
	{
		static bool:bMatch, iFlags, i
		bMatch = false
		
		for(iFlags = get_user_flags(id), i = 0; i < sizeof(g_eModels); i++)
		{
			if(iFlags & g_eModels[i][Flag])
			{
				switch(cs_get_user_team(id))
				{
					case CS_TEAM_CT: cs_set_user_model(id, g_eModels[i][CTModel])
					case CS_TEAM_T: cs_set_user_model(id, g_eModels[i][TModel])
				}
				
				bMatch = true
				break
			}
		}
		
		if(!bMatch)
		{
			static szModel[32]
			cs_get_user_model(id, szModel, charsmax(szModel))
			
			if(TrieKeyExists(g_tModels, szModel))
				cs_reset_user_model(id)
		}
	}
}

precache_player_model(szModel[])
{
	TrieSetCell(g_tModels, szModel, 1)
	
	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)
}
Tote is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 12-25-2023 , 16:03   Re: Added player skins with different flag
Reply With Quote #3

Quote:
Originally Posted by impossible89 View Post
Hello, would it be possible to make a plugin to adjust the skins

An example:

;Flag - "m" - Prefix [Head Admin] // to have option to insert T and CT model

;Flag - "o" - Prefix [Global Admin] // to have option to insert T and CT model

;Flag - "q" - Prefix [Server Admin] // to have option to insert T and CT model

;Flag - "s" - Prefix [VIP] // to have option to insert T and CT model

;Flag - "r" - Prefix [Girl Admin] // to have option to insert T and CT model

Try
Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

enum _:ModelsInfo
{
	Flag,
	CTModel[32],
	TModel[32]
}

// SETTINGS HERE
new const g_eModels[][ModelsInfo] =
{
	{ ADMIN_LEVEL_A, "owner_ct", "owner_t" },      // Owner
	{ ADMIN_LEVEL_B, "admin_ct", "admin_t" },      // Admin
	{ ADMIN_LEVEL_C, "headadmin_ct", "headadmin_t" },        // Head Admin
	{ ADMIN_LEVEL_D, "globaladmin_ct", "globaladmin_t" },    // Global Admin
	{ ADMIN_LEVEL_E, "serveradmin_ct", "serveradmin_t" },    // Server Admin
	{ ADMIN_LEVEL_F, "vip_ct", "vip_t" },                    // VIP
	{ ADMIN_LEVEL_G, "girladmin_ct", "girladmin_t" }         // Girl Admin
}
// END OF SETTINGS

new Trie:g_tModels;

public plugin_init()
{
	register_plugin("Multiple Player Models", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
}

public plugin_end()
	TrieDestroy(g_tModels)

public plugin_precache()
{
	g_tModels = TrieCreate()
	
	for(new i; i < sizeof(g_eModels); i++)
	{
		precache_player_model(g_eModels[i][CTModel])
		precache_player_model(g_eModels[i][TModel])
	}
}

public OnPlayerSpawn(id)
{
	if(is_user_alive(id))
	{
		static bool:bMatch, iFlags, i
		bMatch = false
		
		for(iFlags = get_user_flags(id), i = 0; i < sizeof(g_eModels); i++)
		{
			if(iFlags & g_eModels[i][Flag])
			{
				switch(cs_get_user_team(id))
				{
					case CS_TEAM_CT: cs_set_user_model(id, g_eModels[i][CTModel])
					case CS_TEAM_T: cs_set_user_model(id, g_eModels[i][TModel])
				}
				
				bMatch = true
				break
			}
		}
		
		if(!bMatch)
		{
			static szModel[32]
			cs_get_user_model(id, szModel, charsmax(szModel))
			
			if(TrieKeyExists(g_tModels, szModel))
				cs_reset_user_model(id)
		}
	}
}

precache_player_model(szModel[])
{
	TrieSetCell(g_tModels, szModel, 1)
	
	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)
}
Uzviseni Bog is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 12-25-2023 , 16:04   Re: Added player skins with different flag
Reply With Quote #4

https://forums.alliedmods.net/showpo...79&postcount=3
__________________
amirwolf is offline
impossible89
Member
Join Date: Jun 2020
Old 12-26-2023 , 06:30   Re: Added player skins with different flag
Reply With Quote #5

Thanks to everyone who helped
impossible89 is offline
Reply



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 04:42.


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