This is a winning message plugin. [tested and works, to an extent..] Looks pretty much like this
http://prikachi.com/images/27/2982027J.png except it uses a .mdl file. Would it be possible to make it use sprites instead? Or would that require the whole code to be rewritten?
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "Win models"
#define VERSION "1.0"
#define AUTHOR "reinert"
new bool:CT[ 33 ];
new bool:T[ 33 ];
new const CTwin[ ] = "models/ctwin.mdl";
new const Twin[ ] = "models/twin.mdl";
public plugin_precache( )
{
precache_model( CTwin );
precache_model( Twin );
}
public plugin_init( )
{
register_plugin ( PLUGIN , VERSION , AUTHOR )
RegisterHam ( Ham_Spawn , "player" , "PlayerSpawnPost" , 1 );
register_event ( "SendAudio" , "CT_win" , "a" , "2&%!MRAD_ctwin" );
register_event ( "SendAudio" , "T_win" , "a" , "2&%!MRAD_terwin" );
register_event ( "CurWeapon" , "Cur_Weapon", "be" , "1=1" );
}
public PlayerSpawnPost( id )
{
CT[ id ] = false;
T[ id ] = false;
}
public Cur_Weapon( id )
{
if( CT[ id ] )
set_pev( id , pev_viewmodel2 , CTwin );
else if( T[ id ] )
set_pev( id , pev_viewmodel2 , Twin );
}
public CT_win( )
{
new Players[ 32 ]
new playerCount, i, player
get_players( Players , playerCount , "ch" )
for ( i=0 ; i < playerCount ; i++ )
{
player = Players[ i ]
set_pev( player, pev_viewmodel2 , CTwin )
CT[ player ] = true;
}
}
public T_win( )
{
new Players[ 32 ]
new playerCount, i, player
get_players( Players , playerCount , "ch" )
for ( i=0 ; i < playerCount ; i++ )
{
player = Players[ i ]
set_pev( player, pev_viewmodel2 , Twin )
T[ player ] = true;
}
}
public client_authorized( id )
{
CT[ id ] = false;
T[ id ] = false;
}
public client_disconnect( id )
{
CT[ id ] = false;
T[ id ] = false;
}
Edit:
The reason I'd rather use .spr instead of mdl is that the models rotate randomly for some reason. I'm hoping that won't be an issue with sprites.