AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Please HELP (https://forums.alliedmods.net/showthread.php?t=337389)

Usama Ali 04-17-2022 21:51

Please HELP
 
so basically i have this plugin which changes skin according to steam id.. but the problem is i use zombie mod and when i chose the skin for Terrorist the skin remains the same after the infection starts. the skin does not change to zombie.


IF Any One Can Edit It And Give me a fix... i am using Zombie Plague 4.3
Fix5


plugin link : https://forums.alliedmods.net/showthread.php?t=106094

Supremache 04-17-2022 22:14

Re: Please HELP
 
[
PHP Code:

/**
 * Overrides ZP player model with a different custom model.
 *
 * Note: This will last until player's next infection/humanization/respawn.
 *
 * Note: Don't call more often than absolutely needed.
 *
 * @param id        Player index.
 * @param newmodel    Model name.
 * @param modelindex    Modelindex (optional).
 */
native zp_override_user_model(id, const newmodel[], modelindex 0


Usama Ali 04-17-2022 22:28

Re: Please HELP
 
2 Attachment(s)
Quote:

Originally Posted by Supremache (Post 2777088)
[
PHP Code:

/**
 * Overrides ZP player model with a different custom model.
 *
 * Note: This will last until player's next infection/humanization/respawn.
 *
 * Note: Don't call more often than absolutely needed.
 *
 * @param id        Player index.
 * @param newmodel    Model name.
 * @param modelindex    Modelindex (optional).
 */
native zp_override_user_model(id, const newmodel[], modelindex 0


Hey i did what you said wont work or maybe i dont understand.

here my sma file can you edit this please..

Supremache 04-18-2022 01:11

Re: Please HELP
 
I created this plugin now but haven't tested it, so give it a try.

1. Create confing file with name "CustomModels.ini"
2. Create a custom model for players "SteamID" "Model" "Flags"
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <zombieplague> new const Version[ ] = "1.0.0"; #if !defined MAX_PLAYERS     const MAX_PLAYERS = 32 #endif #if !defined MAX_AUTHID_LENGTH     const MAX_AUTHID_LENGTH = 64 #endif enum _:PlayerModels {     Player_SteamID[ MAX_AUTHID_LENGTH ],     Player_Model[ 64 ],     Player_Flags } new Trie:g_tModels, eData[ PlayerModels ], g_szSteamID[ MAX_PLAYERS + 1 ][ MAX_AUTHID_LENGTH ]; public plugin_init( ) {     register_plugin( "ZP: Custom Models", Version, "Supremache" )     register_cvar( "CustomModels", Version, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED )         g_tModels = TrieCreate( );         RegisterHam( Ham_Spawn, "player", "CBasePlayer_Spawn", 1 ); } public plugin_precache( ) {     ReloadFile( ); } public client_connect( id ) {     get_user_authid( id, g_szSteamID[ id ], charsmax( g_szSteamID[ ] ) ) } public CBasePlayer_Spawn( id ) {     if( !is_user_alive( id ) )     {         return;     }         if( TrieGetArray( g_tModels, g_szSteamID[ id ], eData, sizeof eData ) )     {         if( eData[ Player_Model ][ 0 ] != EOS && !zp_get_user_zombie( id ) && has_all_flags( id, eData[ Player_Flags ] ) )         {             zp_override_user_model( id, eData[ Player_Model ] );         }     } } ReloadFile( ) {     new g_szFile[ 128 ]         get_configsdir( g_szFile, charsmax( g_szFile ) );     add( g_szFile, charsmax( g_szFile ), "/CustomModels.ini" )         new iFile = fopen( g_szFile, "rt" );         if( iFile )     {         new szData[ 512 ], szFlags[ 22 ];                 while( fgets( iFile, szData, charsmax( szData ) ) )         {                 trim( szData );                         switch( szData[ 0 ] )             {                 case EOS, ';', '#', '/': continue;                 default:                 {                     szFlags[ 0 ] = ADMIN_ALL;                                         parse( szData, eData[ Player_SteamID ], charsmax( eData[ Player_SteamID ] ), eData[ Player_Model ], charsmax( eData[ Player_Model ] ), szFlags, charsmax( szFlags ) )                                         if( eData[ Player_SteamID ][ 0 ] )                     {                         precache_player_model( eData[ Player_Model ] );                         eData[ Player_Flags ] = read_flags( szFlags );                         TrieSetArray( g_tModels, eData[ Player_SteamID ], eData, sizeof eData );                     }                                         arrayset( eData, 0, sizeof( eData ) );                 }             }         }         fclose( iFile );     } } //Credits to OciXCrom precache_player_model(const szModel[], &id = 0) {     new model[128]     formatex(model, charsmax(model), "models/player/%s/%sT.mdl", szModel, szModel)     if(file_exists(model))     {         id = precache_generic(model)     }     static const extension[] = "T.mdl"     #pragma unused extension         copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")         return precache_generic(model) }

Usama Ali 04-18-2022 09:21

Re: Please HELP
 
Quote:

Originally Posted by Supremache (Post 2777096)
I created this plugin now but haven't tested it, so give it a try.

1. Create confing file with name "CustomModels.ini"
2. Create a custom model for players "SteamID" "Model" "Flags"
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> new const Version[ ] = "1.0.0"; #if !defined MAX_PLAYERS     const MAX_PLAYERS = 32 #endif #if !defined MAX_AUTHID_LENGTH     const MAX_AUTHID_LENGTH = 64 #endif enum _:PlayerModels {     Player_SteamID[ MAX_AUTHID_LENGTH ],     Player_Model[ 64 ],     Player_Flags } new Trie:g_tModels, eData[ PlayerModels ], g_szSteamID[ MAX_PLAYERS + 1 ][ MAX_AUTHID_LENGTH ]; public plugin_init( ) {     register_plugin( "ZP: Custom Models", Version, "Supremache" )     register_cvar( "CustomModels", Version, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED )         g_tModels = TrieCreate( );         RegisterHam( Ham_Spawn, "player", "CBasePlayer_Spawn", 1 ); } public plugin_precache( ) {     ReloadFile( ); } public client_connect( id ) {     get_user_authid( id, g_szSteamID[ id ], charsmax( g_szSteamID[ ] ) ) } public CBasePlayer_Spawn( id ) {     if( !is_user_alive( id ) )     {         return;     }         if( TrieGetArray( g_tModels, g_szSteamID[ id ], eData, sizeof eData ) )     {         if( eData[ Player_Model ][ 0 ] != EOS && !zp_is_user_zombie( id ) && has_all_flags( id, eData[ Player_Flags ] ) )         {             zp_override_user_model( id, eData[ Player_Model ] );             break;         }     } } ReloadFile( ) {     new g_szFile[ 128 ]         get_configsdir( g_szFile, charsmax( g_szFile ) );     add( g_szFile, charsmax( g_szFile ), "/CustomModels.ini" )         new iFile = fopen( g_szFile, "rt" );         if( iFile )     {         new szData[ 512 ], szFlags[ 22 ];                 while( fgets( iFile, szData, charsmax( szData ) ) )         {                 trim( szData );                         switch( szData[ 0 ] )             {                 case EOS, ';', '#', '/': continue;                 default:                 {                     szFlags[ 0 ] = ADMIN_ALL;                                         parse( szData, eData[ Player_SteamID ], charsmax( eData[ Player_SteamID ] ), eData[ Player_Model ], charsmax( eData[ Player_Model ] ), szFlags, charsmax( szFlags ) )                                         if( eData[ Player_SteamID ][ 0 ] )                     {                         precache_player_model( eData[ Player_Model ] );                         eData[ Player_Flags ] = read_flags( szFlags );                         TrieSetArray( g_tModels, eData[ Player_SteamID ], eData, sizeof eData );                     }                                         arrayset( eData, 0, sizeof( eData ) );                 }             }         }         fclose( iFile );     } } //Credits to OciXCrom precache_player_model(const szModel[], &id = 0) {     new model[128]     formatex(model, charsmax(model), "models/player/%s/%sT.mdl", szModel, szModel)     if(file_exists(model))     {         id = precache_generic(model)     }     static const extension[] = "T.mdl"     #pragma unused extension         copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")         return precache_generic(model) }

the plugin fails to compile even after i put #include <zombieplague...

The Following error occurs


Code:
custom_models.sma(53) : error 017: undefined symbol "zp_is_user_zombie" custom_models.sma(55) : error 017: undefined symbol "zp_override_user_model" custom_models.sma(56) : error 024: "break" or "continue" is out of context

Glad your helping..

Supremache 04-18-2022 09:42

Re: Please HELP
 
Attach the include file of zp mod

Usama Ali 04-18-2022 10:24

Re: Please HELP
 
Quote:

Originally Posted by Supremache (Post 2777122)
Attach the include file of zp mod

The problem has been fixed on my another post..

Thanks For your time and help, means alot


All times are GMT -4. The time now is 21:21.

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