SHOW:
|
|
- or go back to the newest paste.
| 1 | #define DAMAGE_RECIEVED | |
| 2 | #include <amxmodx> | |
| 3 | #include <amxmisc> | |
| 4 | #include <cstrike> | |
| 5 | #include <fun> | |
| 6 | ||
| 7 | static const COLOR[] = "^x04" //green | |
| 8 | static const CONTACT[] = "" | |
| 9 | new maxplayers | |
| 10 | new gmsgSayText | |
| 11 | new mpd, mkb, mhb | |
| 12 | new g_MsgSync | |
| 13 | new health_add | |
| 14 | new health_hs_add | |
| 15 | new health_max | |
| 16 | new nKiller | |
| 17 | new nKiller_hp | |
| 18 | new nHp_add | |
| 19 | new nHp_max | |
| 20 | new g_awp_active | |
| 21 | new g_menu_active | |
| 22 | new CurrentRound | |
| 23 | new bool:HasC4[33] | |
| 24 | new canUse = 0; | |
| 25 | #define Keysrod (1<<0)|(1<<1)|(1<<9) // Keys: 1234567890 | |
| 26 | #if defined DAMAGE_RECIEVED | |
| 27 | new g_MsgSync2 | |
| 28 | #endif | |
| 29 | ||
| 30 | public plugin_init() | |
| 31 | {
| |
| 32 | register_plugin("VIP Eng Version", "3.0", "Dunno")
| |
| 33 | mpd = register_cvar("money_per_damage","3")
| |
| 34 | mkb = register_cvar("money_kill_bonus","200")
| |
| 35 | mhb = register_cvar("money_hs_bonus","500")
| |
| 36 | health_add = register_cvar("amx_vip_hp", "15")
| |
| 37 | health_hs_add = register_cvar("amx_vip_hp_hs", "30")
| |
| 38 | health_max = register_cvar("amx_vip_max_hp", "100")
| |
| 39 | g_awp_active = register_cvar("awp_active", "1")
| |
| 40 | g_menu_active = register_cvar("menu_active", "1")
| |
| 41 | register_event("Damage","Damage","b")
| |
| 42 | register_event("DeathMsg","death_msg","a")
| |
| 43 | register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")
| |
| 44 | register_clcmd("awp","HandleCmd")
| |
| 45 | register_clcmd("sg550","HandleCmd")
| |
| 46 | register_clcmd("g3sg1","HandleCmd")
| |
| 47 | register_clcmd("say /wantvip","ShowMotd")
| |
| 48 | maxplayers = get_maxplayers() | |
| 49 | gmsgSayText = get_user_msgid("SayText")
| |
| 50 | register_clcmd("say", "handle_say")
| |
| 51 | register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
| |
| 52 | register_logevent("LogEvent_RoundStart", 2, "1=Round_Start" );
| |
| 53 | register_event("TextMsg","Event_RoundRestart","a","2&#Game_w")
| |
| 54 | register_event("TextMsg","Event_RoundRestart","a","2&#Game_C");
| |
| 55 | register_event("DeathMsg", "hook_death", "a", "1>0")
| |
| 56 | register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
| |
| 57 | g_MsgSync = CreateHudSyncObj() | |
| 58 | #if defined DAMAGE_RECIEVED | |
| 59 | g_MsgSync2 = CreateHudSyncObj() | |
| 60 | #endif | |
| 61 | } | |
| 62 | ||
| 63 | public on_damage(id) | |
| 64 | {
| |
| 65 | new attacker = get_user_attacker(id) | |
| 66 | ||
| 67 | #if defined DAMAGE_RECIEVED | |
| 68 | // id should be connected if this message is sent, but lets check anyway | |
| 69 | if ( is_user_connected(id) && is_user_connected(attacker) ) | |
| 70 | if (get_user_flags(attacker) & ADMIN_LEVEL_H) | |
| 71 | {
| |
| 72 | new damage = read_data(2) | |
| 73 | ||
| 74 | set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) | |
| 75 | ShowSyncHudMsg(id, g_MsgSync2, "%i^n", damage) | |
| 76 | #else | |
| 77 | if ( is_user_connected(attacker) && if (get_user_flags(attacker) & ADMIN_LEVEL_H) ) | |
| 78 | {
| |
| 79 | new damage = read_data(2) | |
| 80 | #endif | |
| 81 | set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1) | |
| 82 | ShowSyncHudMsg(attacker, g_MsgSync, "%i^n", damage) | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | public Damage(id) | |
| 87 | {
| |
| 88 | new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint) | |
| 89 | if(attacker<=maxplayers && is_user_alive(attacker) && attacker!=id) | |
| 90 | if (get_user_flags(attacker) & ADMIN_LEVEL_H) | |
| 91 | {
| |
| 92 | if(canUse) {
| |
| 93 | new money = read_data(2) * get_pcvar_num(mpd) | |
| 94 | if(hitpoint==1) money += get_pcvar_num(mhb) | |
| 95 | cs_set_user_money(attacker,cs_get_user_money(attacker) + money) | |
| 96 | } | |
| 97 | } | |
| 98 | } | |
| 99 | ||
| 100 | public death_msg() | |
| 101 | {
| |
| 102 | if(read_data(1)<=maxplayers && read_data(1) && read_data(1)!=read_data(2)) cs_set_user_money(read_data(1),cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300) | |
| 103 | } | |
| 104 | ||
| 105 | public LogEvent_RoundStart() | |
| 106 | {
| |
| 107 | canUse = 1; | |
| 108 | set_task(10.0, "turn_vip_off"); | |
| 109 | CurrentRound++; | |
| 110 | new players[32], player, pnum; | |
| 111 | get_players(players, pnum, "a"); | |
| 112 | for(new i = 0; i < pnum; i++) | |
| 113 | {
| |
| 114 | player = players[i]; | |
| 115 | if(is_user_alive(player) && get_user_flags(player) & ADMIN_LEVEL_H) | |
| 116 | {
| |
| 117 | give_item(player, "weapon_hegrenade") | |
| 118 | give_item(player, "weapon_flashbang") | |
| 119 | give_item(player, "weapon_flashbang") | |
| 120 | //give_item(player, "weapon_smokegrenade") | |
| 121 | give_item(player, "item_assaultsuit") | |
| 122 | give_item(player, "item_thighpack") | |
| 123 | ||
| 124 | if (!get_pcvar_num(g_menu_active)) | |
| 125 | return PLUGIN_CONTINUE | |
| 126 | ||
| 127 | if(CurrentRound >= 3) | |
| 128 | {
| |
| 129 | Showrod(player); | |
| 130 | } | |
| 131 | } | |
| 132 | } | |
| 133 | return PLUGIN_HANDLED | |
| 134 | } | |
| 135 | ||
| 136 | public turn_vip_off() {
| |
| 137 | canUse = 0; | |
| 138 | } | |
| 139 | ||
| 140 | public Event_RoundRestart() | |
| 141 | {
| |
| 142 | CurrentRound=0; | |
| 143 | } | |
| 144 | ||
| 145 | public hook_death() | |
| 146 | {
| |
| 147 | // Killer id | |
| 148 | nKiller = read_data(1) | |
| 149 | ||
| 150 | if ( (read_data(3) == 1) && (read_data(5) == 0) ) | |
| 151 | {
| |
| 152 | nHp_add = get_pcvar_num (health_hs_add) | |
| 153 | } | |
| 154 | else {
| |
| 155 | nHp_add = get_pcvar_num (health_add) | |
| 156 | } | |
| 157 | ||
| 158 | ||
| 159 | nHp_max = get_pcvar_num (health_max) | |
| 160 | // Updating Killer HP | |
| 161 | if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H) && (canUse == 0)) | |
| 162 | return; | |
| 163 | ||
| 164 | nKiller_hp = get_user_health(nKiller) | |
| 165 | nKiller_hp += nHp_add | |
| 166 | // Maximum HP check | |
| 167 | if (nKiller_hp > nHp_max) nKiller_hp = nHp_max | |
| 168 | set_user_health(nKiller, nKiller_hp) | |
| 169 | // Hud message "Healed +15/+30 hp" | |
| 170 | set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1) | |
| 171 | show_hudmessage(nKiller, "Healed +%d hp", nHp_add) | |
| 172 | // Screen fading | |
| 173 | message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
| |
| 174 | write_short(1<<10) | |
| 175 | write_short(1<<10) | |
| 176 | write_short(0x0000) | |
| 177 | write_byte(0) | |
| 178 | write_byte(0) | |
| 179 | write_byte(200) | |
| 180 | write_byte(75) | |
| 181 | message_end() | |
| 182 | ||
| 183 | } | |
| 184 | ||
| 185 | public Showrod(id) {
| |
| 186 | show_menu(id, Keysrod, "Free VIP Guns^n\w1. Get M4A1+Deagle ^n\w2. Get AK47+Deagle^n0. Exit^n", -1, "rod") // Display menu | |
| 187 | } | |
| 188 | public Pressedrod(id, key) {
| |
| 189 | /* Menu: | |
| 190 | * VIP Menu | |
| 191 | * 1. Get M4A1+Deagle | |
| 192 | * 2. Get AK47+Deagle | |
| 193 | * 0. Exit | |
| 194 | */ | |
| 195 | if(!canUse) return 0; | |
| 196 | switch (key) {
| |
| 197 | case 0: {
| |
| 198 | if (user_has_weapon(id, CSW_C4) && get_user_team(id) == 1) | |
| 199 | HasC4[id] = true; | |
| 200 | else | |
| 201 | HasC4[id] = false; | |
| 202 | ||
| 203 | strip_user_weapons (id) | |
| 204 | give_item(id,"weapon_m4a1") | |
| 205 | give_item(id,"ammo_556nato") | |
| 206 | give_item(id,"ammo_556nato") | |
| 207 | give_item(id,"ammo_556nato") | |
| 208 | give_item(id,"weapon_deagle") | |
| 209 | give_item(id,"ammo_50ae") | |
| 210 | give_item(id,"ammo_50ae") | |
| 211 | give_item(id,"ammo_50ae") | |
| 212 | give_item(id,"ammo_50ae") | |
| 213 | give_item(id,"ammo_50ae") | |
| 214 | give_item(id,"ammo_50ae") | |
| 215 | give_item(id,"ammo_50ae") | |
| 216 | give_item(id,"weapon_knife") | |
| 217 | give_item(id,"weapon_hegrenade") | |
| 218 | give_item(id, "weapon_flashbang"); | |
| 219 | give_item(id, "weapon_flashbang"); | |
| 220 | //give_item(id, "weapon_smokegrenade"); | |
| 221 | give_item(id, "item_assaultsuit"); | |
| 222 | give_item(id, "item_thighpack"); | |
| 223 | client_print(id, print_center, "You Taked Free M4A1 and Deagle") | |
| 224 | ||
| 225 | if (HasC4[id]) | |
| 226 | {
| |
| 227 | give_item(id, "weapon_c4"); | |
| 228 | cs_set_user_plant( id ); | |
| 229 | } | |
| 230 | } | |
| 231 | case 1: {
| |
| 232 | if (user_has_weapon(id, CSW_C4) && get_user_team(id) == 1) | |
| 233 | HasC4[id] = true; | |
| 234 | else | |
| 235 | HasC4[id] = false; | |
| 236 | ||
| 237 | strip_user_weapons (id) | |
| 238 | give_item(id,"weapon_ak47") | |
| 239 | give_item(id,"ammo_762nato") | |
| 240 | give_item(id,"ammo_762nato") | |
| 241 | give_item(id,"ammo_762nato") | |
| 242 | give_item(id,"weapon_deagle") | |
| 243 | give_item(id,"ammo_50ae") | |
| 244 | give_item(id,"ammo_50ae") | |
| 245 | give_item(id,"ammo_50ae") | |
| 246 | give_item(id,"ammo_50ae") | |
| 247 | give_item(id,"ammo_50ae") | |
| 248 | give_item(id,"ammo_50ae") | |
| 249 | give_item(id,"ammo_50ae") | |
| 250 | give_item(id,"weapon_knife") | |
| 251 | give_item(id,"weapon_hegrenade") | |
| 252 | give_item(id, "weapon_flashbang"); | |
| 253 | give_item(id, "weapon_flashbang"); | |
| 254 | //give_item(id, "weapon_smokegrenade"); | |
| 255 | give_item(id, "item_assaultsuit"); | |
| 256 | give_item(id, "item_thighpack"); | |
| 257 | client_print(id, print_center, "You Taked Free AK47 and Deagle") | |
| 258 | ||
| 259 | if (HasC4[id]) | |
| 260 | {
| |
| 261 | give_item(id, "weapon_c4"); | |
| 262 | cs_set_user_plant( id ); | |
| 263 | } | |
| 264 | } | |
| 265 | case 9: {
| |
| 266 | } | |
| 267 | } | |
| 268 | return PLUGIN_CONTINUE | |
| 269 | } | |
| 270 | ||
| 271 | public HandleCmd(id){
| |
| 272 | if (!get_pcvar_num(g_awp_active)) | |
| 273 | return PLUGIN_CONTINUE | |
| 274 | if(get_user_flags(id) & ADMIN_LEVEL_H) | |
| 275 | return PLUGIN_CONTINUE | |
| 276 | client_print(id, print_center, "Sniper's Only For VIP's") | |
| 277 | return PLUGIN_HANDLED | |
| 278 | } | |
| 279 | ||
| 280 | public ShowMotd(id) | |
| 281 | {
| |
| 282 | show_motd(id, "vip.txt") | |
| 283 | } | |
| 284 | public client_authorized(id) | |
| 285 | {
| |
| 286 | set_task(30.0, "PrintText" ,id) | |
| 287 | } | |
| 288 | public PrintText(id) | |
| 289 | {
| |
| 290 | client_print(id, print_chat, "[VIP] write /wantvip and u will see how get VIP and VIP privilegies.") | |
| 291 | } | |
| 292 | ||
| 293 | public handle_say(id) {
| |
| 294 | new said[192] | |
| 295 | read_args(said,192) | |
| 296 | if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/vips") != -1 ) | |
| 297 | set_task(0.1,"print_adminlist",id) | |
| 298 | return PLUGIN_CONTINUE | |
| 299 | } | |
| 300 | ||
| 301 | public print_adminlist(user) | |
| 302 | {
| |
| 303 | new adminnames[33][32] | |
| 304 | new message[256] | |
| 305 | new contactinfo[256], contact[112] | |
| 306 | new id, count, x, len | |
| 307 | ||
| 308 | for(id = 1 ; id <= maxplayers ; id++) | |
| 309 | if(is_user_connected(id)) | |
| 310 | if(get_user_flags(id) & ADMIN_LEVEL_H) | |
| 311 | get_user_name(id, adminnames[count++], 31) | |
| 312 | ||
| 313 | len = format(message, 255, "%s VIP ONLINE: ",COLOR) | |
| 314 | if(count > 0) {
| |
| 315 | for(x = 0 ; x < count ; x++) {
| |
| 316 | len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"") | |
| 317 | if(len > 96 ) {
| |
| 318 | print_message(user, message) | |
| 319 | len = format(message, 255, "%s ",COLOR) | |
| 320 | } | |
| 321 | } | |
| 322 | print_message(user, message) | |
| 323 | } | |
| 324 | else {
| |
| 325 | len += format(message[len], 255-len, "No VIP online.") | |
| 326 | print_message(user, message) | |
| 327 | } | |
| 328 | ||
| 329 | get_cvar_string("amx_contactinfo", contact, 63)
| |
| 330 | if(contact[0]) {
| |
| 331 | format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact) | |
| 332 | print_message(user, contactinfo) | |
| 333 | } | |
| 334 | } | |
| 335 | ||
| 336 | print_message(id, msg[]) {
| |
| 337 | message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
| |
| 338 | write_byte(id) | |
| 339 | write_string(msg) | |
| 340 | message_end() | |
| 341 | } |