Parent Directory | Revision Log
Revision 25 - (view) (download)
1 : | ian | 1 | /* |
2 : | ian | 25 | Weapon Arena v0.1 |
3 : | Copyright (C) 2005 Ian (Juan) Cammarata | ||
4 : | |||
5 : | This program is free software: you can redistribute it and/or modify | ||
6 : | it under the terms of the GNU Affero General Public License as | ||
7 : | published by the Free Software Foundation, either version 3 of the | ||
8 : | License, or (at your option) any later version. | ||
9 : | |||
10 : | This program is distributed in the hope that it will be useful, | ||
11 : | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 : | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 : | GNU Affero General Public License for more details. | ||
14 : | |||
15 : | You should have received a copy of the GNU Affero General Public License | ||
16 : | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 : | -------------------------------------------------------------------------------- | ||
18 : | |||
19 : | ian | 1 | To do: |
20 : | |||
21 : | Auto freeze time/buy time adjustment. | ||
22 : | Stop weapon selected multiple times in one deal of guns. | ||
23 : | Some way to choose what guys to use. | ||
24 : | Unlimited ammo, 2 types. | ||
25 : | ian | 25 | |
26 : | -------------------------------------------------------------------------------- | ||
27 : | |||
28 : | http://ian.cammarata.us | ||
29 : | For AMX 2005 | ||
30 : | 5/21/2005 4:22:27 AM | ||
31 : | -------------------------------------------------------------------------------- | ||
32 : | ian | 1 | */ |
33 : | |||
34 : | #include <amxmod> | ||
35 : | #include <fun> | ||
36 : | #include <amxmisc> | ||
37 : | #include <VexdUM_stock> | ||
38 : | #include <cstrike> | ||
39 : | #include <cstrike2> | ||
40 : | #include <lib_targets> | ||
41 : | |||
42 : | #define EV_SZ_buying "buying" | ||
43 : | |||
44 : | new curwpn[17],usedwpns,lastwpn | ||
45 : | new equipmm=0,bool:rqup=false | ||
46 : | new bool:waon=false | ||
47 : | |||
48 : | public spawned(id){ | ||
49 : | if(waon){ | ||
50 : | set_msg_block(get_user_msgid("AmmoPickup"),2) | ||
51 : | set_msg_block(get_user_msgid("WeapPickup"),2) | ||
52 : | set_msg_block(get_user_msgid("ItemPickup"),2) | ||
53 : | //weaponstrip(id,1) | ||
54 : | new ida[1] | ||
55 : | ida[0]=id | ||
56 : | set_task(0.1,"delaystrip",_,ida,1) | ||
57 : | cs_set_user_money(id,0,0) | ||
58 : | } | ||
59 : | else if(rqup){ | ||
60 : | rqup=false | ||
61 : | set_task(0.1,"reequip") | ||
62 : | } | ||
63 : | return PLUGIN_HANDLED | ||
64 : | } | ||
65 : | public delaystrip(ida[1]){ | ||
66 : | if(waon){ | ||
67 : | weaponstrip(ida[0],get_cvar_num("amx_wpnarena_spawn_knife")?0:1) | ||
68 : | if(get_cvar_num("amx_wpnarena_spawn_randwpn")){ | ||
69 : | if(equal(curwpn,"weapon_hegrenade")){ | ||
70 : | give_item(ida[0],curwpn) | ||
71 : | set_offset_int(ida[0],388,254) | ||
72 : | } | ||
73 : | else for(new i=0;i<7;i++)give_item(ida[0],curwpn) | ||
74 : | } | ||
75 : | } | ||
76 : | return PLUGIN_HANDLED | ||
77 : | } | ||
78 : | public round_start(){ | ||
79 : | set_msg_block(get_user_msgid("AmmoPickup"),0) | ||
80 : | set_msg_block(get_user_msgid("WeapPickup"),0) | ||
81 : | set_msg_block(get_user_msgid("ItemPickup"),0) | ||
82 : | return PLUGIN_HANDLED | ||
83 : | } | ||
84 : | public round_end(){ | ||
85 : | if(get_cvar_num("amx_wpnarena")){ | ||
86 : | if(!waon){ | ||
87 : | waon=true | ||
88 : | client_print(0,print_chat,"[Weapon Arena] Weapon Arena enabled") | ||
89 : | if(get_cvar_num("amx_wpnarena_nopickup"))disable_armory_ents() | ||
90 : | set_msg_block(get_user_msgid("StatusIcon"),2)//Block buying | ||
91 : | if(equipmm>0){ | ||
92 : | entity_set_string(equipmm,EV_SZ_targetname,"game_playersspawn_d") | ||
93 : | } | ||
94 : | } | ||
95 : | } | ||
96 : | else{ | ||
97 : | if(waon){ | ||
98 : | waon=false | ||
99 : | client_print(0,print_chat,"[Weapon Arena] Weapon Arena disabled") | ||
100 : | enable_armory_ents() | ||
101 : | new players[32],num | ||
102 : | get_players(players,num,"a") | ||
103 : | for(new i=0;i<num;i++)weaponstrip(players[i],1) | ||
104 : | set_msg_block(get_user_msgid("StatusIcon"),0)//Unblock buying | ||
105 : | if(equipmm>0)entity_set_string(equipmm,EV_SZ_targetname,"game_playerspawn") | ||
106 : | rqup=true | ||
107 : | } | ||
108 : | } | ||
109 : | if(waon){ | ||
110 : | if(get_cvar_num("amx_wpnarena_spawn_randwpn")){ | ||
111 : | if(usedwpns>=((1<<26)-1)){ | ||
112 : | usedwpns=0 | ||
113 : | client_print(0,print_chat,"[Weapon Arena] All weapons have been used, reseting list.") | ||
114 : | } | ||
115 : | new wpn[10] | ||
116 : | while(!strlen(wpn)){ | ||
117 : | new i=random(26) | ||
118 : | if(!(usedwpns&(1<<i))&&i!=lastwpn){ | ||
119 : | lastwpn=i | ||
120 : | switch(i){ | ||
121 : | case 0:wpn="glock18" | ||
122 : | case 1:wpn="usp" | ||
123 : | case 2:wpn="p228" | ||
124 : | case 3:wpn="deagle" | ||
125 : | case 4:wpn="elite" | ||
126 : | case 5:wpn="fiveseven" | ||
127 : | case 6:wpn="m3" | ||
128 : | case 7:wpn="xm1014" | ||
129 : | case 8:wpn="mac10" | ||
130 : | case 9:wpn="tmp" | ||
131 : | case 10:wpn="mp5navy" | ||
132 : | case 11:wpn="ump45" | ||
133 : | case 12:wpn="p90" | ||
134 : | case 13:wpn="galil" | ||
135 : | case 14:wpn="famas" | ||
136 : | case 15:wpn="ak47" | ||
137 : | case 16:wpn="m4a1" | ||
138 : | case 17:wpn="sg552" | ||
139 : | case 18:wpn="aug" | ||
140 : | case 19:wpn="scout" | ||
141 : | case 20:wpn="awp" | ||
142 : | case 21:wpn="g3sg1" | ||
143 : | case 22:wpn="sg550" | ||
144 : | case 23:wpn="m249" | ||
145 : | case 24:wpn="knife" | ||
146 : | case 25:wpn="hegrenade" | ||
147 : | } | ||
148 : | usedwpns+=(1<<i) | ||
149 : | } | ||
150 : | } | ||
151 : | if(equal(wpn,"hegrenade")){ | ||
152 : | set_msg_block(get_user_msgid("SendAudio"),2) | ||
153 : | set_msg_block(get_user_msgid("TextMsg"),2) | ||
154 : | } | ||
155 : | else{ | ||
156 : | set_msg_block(get_user_msgid("SendAudio"),0) | ||
157 : | set_msg_block(get_user_msgid("TextMsg"),0) | ||
158 : | } | ||
159 : | client_print(0,print_chat,"[Weapon Arena] The weapon for next round will be %s.",wpn) | ||
160 : | new targets[32],targnum=0 | ||
161 : | targets=targets_find(0,targnum,ALIVE,"str*") | ||
162 : | for(new i=0;i<targnum;i++)weaponstrip(targets[i],1) | ||
163 : | set_task(0.1,"rm_wpnboxes") | ||
164 : | format(curwpn,sizeof(curwpn)-1,"weapon_%s",wpn) | ||
165 : | } | ||
166 : | } | ||
167 : | return PLUGIN_HANDLED | ||
168 : | } | ||
169 : | public rm_wpnboxes(){//Put in function for use with set_task | ||
170 : | remove_entities("weaponbox") | ||
171 : | return PLUGIN_HANDLED | ||
172 : | } | ||
173 : | public reequip(){ | ||
174 : | new players[32],num | ||
175 : | get_players(players,num,"ae","CT") | ||
176 : | for(new i=0;i<num;i++){ | ||
177 : | for(new j=0;j<3;j++)give_item(players[i],"weapon_usp") | ||
178 : | give_item(players[i],"weapon_knife") | ||
179 : | } | ||
180 : | get_players(players,num,"ae","TERRORIST") | ||
181 : | for(new i=0;i<num;i++){ | ||
182 : | for(new j=0;j<3;j++)give_item(players[i],"weapon_glock18") | ||
183 : | give_item(players[i],"weapon_knife") | ||
184 : | } | ||
185 : | get_players(players,num) | ||
186 : | for(new i=0;i<num;i++)cs_set_user_money(players[i],get_cvar_num("mp_startmoney")) | ||
187 : | } | ||
188 : | public wa_toggle(id,level,cid){ | ||
189 : | if(cmd_access(id,level,cid,1)){ | ||
190 : | if(get_cvar_num("amx_wpnarena")){ | ||
191 : | set_cvar_num("amx_wpnarena",0) | ||
192 : | client_print(id,print_console,"[Weapon Arena] Weapon Arena disabled") | ||
193 : | } | ||
194 : | else{ | ||
195 : | set_cvar_num("amx_wpnarena",1) | ||
196 : | client_print(id,print_console,"[Weapon Arena] Weapon Arena enabled") | ||
197 : | } | ||
198 : | } | ||
199 : | return PLUGIN_HANDLED | ||
200 : | } | ||
201 : | public disable_armory_ents(){ | ||
202 : | new ent=find_entity(-1,"armoury_entity") | ||
203 : | while(ent>0){ | ||
204 : | set_rendering(ent,kRenderFxGlowShell,255,0,0,kRenderNormal,50) | ||
205 : | entity_set_int(ent,EV_INT_solid,SOLID_NOT) | ||
206 : | ent=find_entity(ent,"armoury_entity") | ||
207 : | } | ||
208 : | return PLUGIN_HANDLED | ||
209 : | } | ||
210 : | public enable_armory_ents(){ | ||
211 : | new ent=find_entity(-1,"armoury_entity") | ||
212 : | while(ent>0){ | ||
213 : | set_rendering(ent,kRenderFxNone,255,0,0,kRenderNormal,255) | ||
214 : | entity_set_int(ent,EV_INT_solid,SOLID_TRIGGER) | ||
215 : | ent=find_entity(ent,"armoury_entity") | ||
216 : | } | ||
217 : | return PLUGIN_HANDLED | ||
218 : | } | ||
219 : | public plugin_cfg(){ | ||
220 : | new ent=find_entity(-1,"multi_manager") | ||
221 : | while(ent>0&&equipmm==0){ | ||
222 : | new targname[17] | ||
223 : | entity_get_string(ent,EV_SZ_targetname,targname,sizeof(targname)-1) | ||
224 : | if(equal(targname,"game_playerspawn"))equipmm=ent | ||
225 : | ent=find_entity(ent,"multi_manager") | ||
226 : | } | ||
227 : | ent=find_entity(-1,"armoury_entity") | ||
228 : | while(ent>0){ | ||
229 : | if(cs_get_armoury_type(ent)==CSW_AWP)cs_set_armoury_type(ent,CSW_SCOUT) | ||
230 : | ent=find_entity(ent,"armoury_entity") | ||
231 : | } | ||
232 : | return PLUGIN_CONTINUE | ||
233 : | } | ||
234 : | public plugin_init(){ | ||
235 : | register_plugin("Weapon Arena","0.3","Don Juan-jello") | ||
236 : | //CVARS | ||
237 : | register_cvar("amx_wpnarena","1") | ||
238 : | register_cvar("amx_wpnarena_spawn_randwpn","1") | ||
239 : | register_cvar("amx_wpnarena_spawn_knife","1") | ||
240 : | register_cvar("amx_wpnarena_nopickup","1") | ||
241 : | register_cvar("amx_wpnarena_nobuy","1") | ||
242 : | |||
243 : | register_clcmd("amx_wpnarena_toggle","wa_toggle",ADMIN_RESERVATION,"- Toggles weapon arena on/off.") | ||
244 : | //register_event("DeathMsg","death_msg","a") | ||
245 : | register_event("ResetHUD","spawned","b") | ||
246 : | /* Called when an entity is spawned */ | ||
247 : | register_logevent("round_start",2,"1=Round_Start") | ||
248 : | register_logevent("round_end",2,"1=Round_End") | ||
249 : | return PLUGIN_CONTINUE | ||
250 : | } |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |