You have two identical if statements, which doesn't make any sense. Explain what you are trying to do.
Also, when dealing with numeric values, you would not use an ampersand (&) to compare values. Instead you would use two equal signs (==).
So you would do
if( get_cvar_num( "mp_friendlyfire" ) == 1 )
{
// code here
}
What I would suggest is getting the pointer to the cvar in plugin_init and then using that pointer instead of getting a cvar num. That would work as such:
PHP Code:
new g_pFriendlyFire;
public plugin_init()
{
g_pFriendlyFire = get_cvar_pointer( "mp_friendlyfire" );
}
public yourFunction()
{
switch( whatever )
{
case 1:
{
if(get_pcvar_num(g_pFriendlyFire) == 1)
{
new name[32]
get_user_name(id, name, 31)
ColorChat(0, GREEN, "^x04%s ^x01 has turned friendlyfire ^x04ON", name)
set_pcvar_num(g_pFriendlyFire,1)
}
}
}
}
__________________