It didn't seem to work. It doesn't identify each players but treats them in a similar fashion imo. I use pl[] bool array to see which color to show for each player. But i found out the only value that matters is pl[0] and when it is true, it changes the color for all players vice versa. I wonder what goes wrong? If pl[1] = true then it should change the color only for player1.
Ideas?
Anyway are there other methods to manipulate sprite colors and other values?
Code:
#include <amxmodx>
#include <fakemeta>
#include <amxmisc>
#define PLUGIN "ESF color change"
#define VERSION "1.0"
#define AUTHOR "thompsoni"
new gMsgPowerUp;
new bool:pl[33]
new i;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
//register_forward( FM_EmitSound, "fw_EmitSound" );
//change color cmd
register_clcmd("say /test", "cmd_test")
gMsgPowerUp = get_user_msgid( "Powerup" );
register_message( gMsgPowerUp, "Message_Powerup" );
for(i=0; i<32; i++)
{
pl[i] = false;
}
}
public cmd_test(id)
{
pl[id] = !pl[id] /* assign the variable to it's opossite value, if true, set false, if false, set true. */
if(pl[id])
{
client_print(id, print_chat, "Toggled ON")
}
else
{
client_print(id, print_chat, "Toggled OFF")
}
}
public Message_Powerup(msgid, dest, id)
{
if( pl[id] )
{
set_msg_arg_int( 2, ARG_BYTE, 255 );
set_msg_arg_int( 3, ARG_BYTE, 0 );
set_msg_arg_int( 4, ARG_BYTE, 0 );
}
else
{
set_msg_arg_int( 2, ARG_BYTE, 255 );
set_msg_arg_int( 3, ARG_BYTE, 0 );
set_msg_arg_int( 4, ARG_BYTE, 255 );
}
}