Raised This Month: $ Target: $400
 0% 

Help add team check (FreeRound)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PandaDnB
Senior Member
Join Date: Jan 2012
Old 04-28-2012 , 17:59   Help add team check (FreeRound)
Reply With Quote #1

Hello, I need to add a check if a terrorist or a counter terrost has triggered a trap here:
Code:
   if(g_use_button){
      client_print(0,print_chat, "[Deathrun[4]Fun] You Used A Trap, FreeRound Is Not Possble!");
      return PLUGIN_HANDLED
   }
Because on some maps CT's have to push a button to open the door and the plugin counts it as a trap and T's cant give a free round. Here is the whole code
Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN "FreeRun"
#define VERSION "1.0"
#define AUTHOR "PomanoB"

new g_free
new g_cvar_t_only
new g_free_time
new bool:g_bFree
new bool:g_use_button

public plugin_init() {
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   g_cvar_t_only = register_cvar("free_run_t_only", "1")
   
   register_clcmd("say free", "cmdFree")
   register_clcmd("say /free", "cmdFree")

   register_event("HLTV", "eventRoundStart", "a", "1=0", "2=0")
   RegisterHam(Ham_Spawn, "player", "player_spawn",1)
   
   RegisterHam(Ham_Touch, "armoury_entity", "fwdTouch")
   RegisterHam(Ham_Touch, "weaponbox", "fwdTouch")
   RegisterHam(Ham_Use, "func_button", "fwdUse")
}
public player_spawn(id){
   
   if(g_bFree){
      set_task(5.0, "strip_weapons", id)
   }
}
public strip_weapons(id){
   
   fm_strip_user_weapons(id)
   fm_give_item(id, "weapon_knife")
   
}
public eventRoundStart() {
   g_free = false
   g_bFree = false
   g_free_time = true
   g_use_button = false
   
   set_task(20.0,"timer")
}
public timer(){
   g_free_time = false
   
}
public cmdFree(id) {

   if (get_pcvar_num(g_cvar_t_only) && get_user_team(id) != 1) {
      client_print(0,print_chat, "[Deathrun[4]Fun] Only T's Can Give FreeRound!");
      return PLUGIN_HANDLED
   }

   if(g_use_button){
      client_print(0,print_chat, "[Deathrun[4]Fun] You Used A Trap, FreeRound Is Not Possble!");
      return PLUGIN_HANDLED
   }
   
   if(g_free_time){
      new players[32], plNum
      get_players(players, plNum, "ace", "TERRORIST")
      
      g_free = true
      g_bFree = true
      
      set_hudmessage(0, 255, 255, 0.02, -1.0)
      show_hudmessage(0, "FreeRound!")
            
      new i
      get_players(players, plNum, "ah")
      for (i = 0; i < plNum; i++) {
         fm_strip_user_weapons(players[i])
         fm_give_item(players[i], "weapon_knife")
      }
   }else{
      set_hudmessage(0, 255, 255, 0.02, -1.0)
      show_hudmessage(id, "Only In the first 20 sec.!")
   }
   return PLUGIN_HANDLED
   
}

public fwdTouch(ent, id) {
   if (is_user_alive(id) && g_free)
      return HAM_SUPERCEDE
   
   return HAM_IGNORED
}  

public fwdUse(ent, idcaller, idactivator, use_type, Float:value) {
   g_use_button = true
   if (is_user_alive(idactivator) && g_free && get_user_team(idactivator) == 1) {
     client_print(0,print_chat, "[Deathrun[4]Fun] It's FreeRound, You Cannot Use Traps!");
      return HAM_SUPERCEDE  
   }
   
   return HAM_IGNORED
}

Last edited by PandaDnB; 04-28-2012 at 18:01. Reason: Mistake
PandaDnB is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode