Parent Directory | Revision Log
Revision 1 - (view) (download)
1 : | ian | 1 | /* |
2 : | cstrike2 v0.1.2 | ||
3 : | Copyright (C) 2006-2007 Ian (Juan) Cammarata | ||
4 : | |||
5 : | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | ||
6 : | |||
7 : | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
8 : | |||
9 : | You should have received a copy of the GNU General Public License along with this program; go to http://www.opensource.org/licenses/gpl-license.php | ||
10 : | Additional String manipulation | ||
11 : | */ | ||
12 : | |||
13 : | #if defined _cstrike2_included | ||
14 : | #endinput | ||
15 : | #endif | ||
16 : | #define _cstrike2_included | ||
17 : | |||
18 : | //Set whether play has shield | ||
19 : | stock cs_set_user_shield(id,onoff=1){ | ||
20 : | if(onoff)set_offset_int(id,510,(1<<24)) | ||
21 : | else set_offset_int(id,510,0) | ||
22 : | return 1 | ||
23 : | } | ||
24 : | |||
25 : | // Set Score Attribute | ||
26 : | // 0 nothing | ||
27 : | // 1 dead | ||
28 : | // 2 bomb | ||
29 : | // 4 vip | ||
30 : | stock cs_set_user_scoreattrib(id,attrib=0){ | ||
31 : | message_begin(2,get_user_msgid("ScoreAttrib"),{0,0,0},0) | ||
32 : | write_byte(id) | ||
33 : | write_byte(attrib) | ||
34 : | message_end() | ||
35 : | } | ||
36 : | |||
37 : | // 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. | ||
38 : | // The control characters can be copied and pasted in notepad. | ||
39 : | // 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. | ||
40 : | // 0x03 (ETX) - Use team color from this point forward | ||
41 : | // 0x04 (EOT) - Use location color from this point forward | ||
42 : | // 0x01 (SOH) - Use normal color from this point forward | ||
43 : | // Sample string "^x03Team colored text ^x01Normal color" | ||
44 : | public saytext(sndr,rcvr,txt[]){ | ||
45 : | message_begin(1,get_user_msgid("SayText"),{0,0,0},rcvr) | ||
46 : | write_byte(sndr) | ||
47 : | write_string(txt) | ||
48 : | message_end() | ||
49 : | return PLUGIN_CONTINUE | ||
50 : | } | ||
51 : | public saytextall(sndr,txt[]){ | ||
52 : | message_begin(2,get_user_msgid("SayText"),{0,0,0},0) | ||
53 : | write_byte(sndr) | ||
54 : | write_string(txt) | ||
55 : | message_end() | ||
56 : | return PLUGIN_CONTINUE | ||
57 : | } | ||
58 : | //Be sure to pass this function the text without any color codes in it. | ||
59 : | stock saytextlog(sndr,txt[],saytype[]="say"){ | ||
60 : | if(sndr>0){ | ||
61 : | new name[32],steam[20],team[10] | ||
62 : | get_user_name(sndr,name,31) | ||
63 : | get_user_authid(sndr,steam,19) | ||
64 : | get_user_team(sndr,team,9) | ||
65 : | log_message("^"%s<%d><%s><%s>^" %s ^"%s^"%s",name,get_user_userid(sndr),steam,team,saytype,txt,is_user_alive(sndr)?"":" (dead)") | ||
66 : | } | ||
67 : | else log_message("Server say ^"%s^"",txt) | ||
68 : | return PLUGIN_CONTINUE | ||
69 : | } | ||
70 : | stock weaponstrip(id,noknife=0){ | ||
71 : | new ent=create_entity("player_weaponstrip") | ||
72 : | DispatchSpawn(ent) | ||
73 : | entity_use(ent,id) | ||
74 : | if(!noknife)give_item(id,"weapon_knife") | ||
75 : | remove_entity(ent) | ||
76 : | set_offset_int(id,116,0) | ||
77 : | return 1 | ||
78 : | } |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |