AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   player model changing in fakemeta (https://forums.alliedmods.net/showthread.php?t=87724)

Hunter-Digital 03-15-2009 16:02

player model changing in fakemeta
 
I can't understand a damn thing from this http://forums.alliedmods.net/showthread.php?t=69386 because the codes are scrambled across the page...
also I found this in some plugins:
PHP Code:

engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "model""model_name"

but doesn't seem to work... it worked for an older plugin of mine but for a plain simple plugin it doesn't... :|

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_clcmd("test_model""test_model")
}

public 
plugin_precache()
{
    
precache_model("models/player/vip/vip.mdl")
}

public 
test_model(id)
{
    
engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "model""vip")

    return 
PLUGIN_HANDLED



Arkshine 03-15-2009 16:16

Re: player model changing in fakemeta
 
Try something that ( Orangetuz' method ) :

Code:
    #include <amxmodx>     #include <fakemeta>     #include <hamsandwich>     const MAX_MODEL_LENGTH = 32;     const MAX_CLIENTS      = 32;     new gModel[ MAX_CLIENTS + 1 ][ MAX_MODEL_LENGTH ];         new const gModelName [] = "model";     new const gNewModel  [] = "vip";     public plugin_precache ()     {         precache_model( "models/player/vip/vip.mdl" );     }     public plugin_init ()     {         RegisterHam( Ham_Spawn, "player", "Event_PlayerSpawn", 1 );         register_forward( FM_SetClientKeyValue, "Event_SetClientKeyValue" );         register_message( get_user_msgid( "ClCorpse" ), "Event_ClCorpse" );     }     public client_putinserver ( Client )     {         gModel[ Client ][ 0 ] = '^0';     }     public Event_PlayerSpawn ( const Client )     {         if ( is_user_alive( Client ) )         {             copy( gModel[ Client ], charsmax( gModel[] ), gNewModel );             set_user_info( Client, gModelName, gModel[ Client] );         }     }     public Event_SetClientKeyValue ( const Client, const InfoBuffer[], const Key[], const Value[] )     {         if ( gModel[ Client ][ 0 ] && equal( Key, gModelName ) && !equal( Value, gModel[ Client ] ) )         {             set_user_info( Client, gModelName, gModel[ Client ] );             return FMRES_SUPERCEDE;         }         return FMRES_IGNORED;     }     public Event_ClCorpse ()     {         new Client = get_msg_arg_int( 12 );         if ( gModel[ Client ][ 0 ] )         {             set_msg_arg_string( 1, gModel[ Client ] );         } }

Hunter-Digital 03-16-2009 07:20

Re: player model changing in fakemeta
 
thanks, works great, but there's still a mistery behind that code above... it's much more simple but doesn't seem to work... at least, anymore, 'cause it did sometime...

hleV 03-16-2009 10:22

Re: player model changing in fakemeta
 
Counter-Strike always checks if player's model is the default one, if not - set it back. You would have to block that check if you want your code to work. Check how it's done in the code arkshine provided.


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

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