/*Cstrike Stocks 2
* Version 0.1.2
*
* by Don Juan-jello
* www.jello-net.com
*
* This file is provided as is (no warranties).
*/

#if defined _cstrike2_included
  #endinput
#endif
#define _cstrike2_included

//Set whether play has shield
stock cs_set_user_shield(id,onoff=1){
	if(onoff)set_offset_int(id,510,(1<<24))
	else set_offset_int(id,510,0)
	return 1
}

//	Set Score Attribute
//	0 nothing
//	1 dead
//	2 bomb
//	4 vip
stock cs_set_user_scoreattrib(id,attrib=0){
	message_begin(2,get_user_msgid("ScoreAttrib"),{0,0,0},0)
	write_byte(id)
	write_byte(attrib)
	message_end()
}

//	Radio and chat strings can have control characters embedded to set colors. For the control characters to be used, one must be at the start of the string.
//	The control characters can be copied and pasted in notepad.
//	0x02 (STX) - Use team color up to the end of the player name. This only works at the start of the string, and precludes using the other control characters.
//	0x03 (ETX) - Use team color from this point forward
//	0x04 (EOT) - Use location color from this point forward
//	0x01 (SOH) - Use normal color from this point forward
//	Sample string "^x03Team colored text ^x01Normal color"
public saytext(sndr,rcvr,txt[]){
	message_begin(1,get_user_msgid("SayText"),{0,0,0},rcvr)
	write_byte(sndr)
	write_string(txt)
	message_end()
	return PLUGIN_CONTINUE
}
public saytextall(sndr,txt[]){
	message_begin(2,get_user_msgid("SayText"),{0,0,0},0)
	write_byte(sndr)
	write_string(txt)
	message_end()
	return PLUGIN_CONTINUE
}
//Be sure to pass this function the text without any color codes in it.
stock saytextlog(sndr,txt[],saytype[]="say"){
	if(sndr>0){
		new name[32],steam[20],team[10]
		get_user_name(sndr,name,31)
		get_user_authid(sndr,steam,19)
		get_user_team(sndr,team,9)
		log_message("^"%s<%d><%s><%s>^" %s ^"%s^"%s",name,get_user_userid(sndr),steam,team,saytype,txt,is_user_alive(sndr)?"":" (dead)")
	}
	else log_message("Server say ^"%s^"",txt)
	return PLUGIN_CONTINUE
}
stock weaponstrip(id,noknife=0){
	new ent=create_entity("player_weaponstrip")
	DispatchSpawn(ent)
	entity_use(ent,id)
	if(!noknife)give_item(id,"weapon_knife")
	remove_entity(ent)
	set_offset_int(id,116,0)
	return 1
}
