AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking Flashlight For Terrorists Only (moved from Support/Help) (https://forums.alliedmods.net/showthread.php?t=57746)

Paulster1022 07-10-2007 15:09

Blocking Flashlight For Terrorists Only (moved from Support/Help)
 
Hello. Im trying to block the flashlight for terrorists but my code does not seem to work....as i hoped it would. The Flashlight is not working for both terrorists and counter terrorists....and something is definetly wrong..that i can not figure out. Also the client_print will not show anything.....the function is not working properly and mp_flashlight is 1.
Code:

register_impulse(100, "cl_cmd")

register_forward(FM_Cmdstart, "cl_cmd")


public cl_cmd(id, handle, seed)
{
  new impulse = get_uc(handle, UC_Impulse)
  if(cs_get_user_team(id) == CS_TEAM_T) && (impulse == 100)
  {
            client_print(id, print_chat, "[Vampire Mod] Vampires Can Not Use Flashlights.")
          set_uc(handle, UC_Impulse, 0)
  }
  return FMRES_HANDLED
}


vvg125 07-10-2007 15:14

Re: Blocking Flashlight For Terrorists Only
 
Try changing this plugin to work for Ts only and not CTs:

http://forums.alliedmods.net/showpos...7&postcount=12


Change this:

Code:

  if(cs_get_user_team(player) == CS_TEAM_T)
to:

Code:

  if(cs_get_user_team(player) == CS_TEAM_CT)
I'm only suggesting it because it's already made...

Paulster1022 07-10-2007 15:34

Re: Blocking Flashlight For Terrorists Only
 
I want the flashlight to work for Ct's only and block the flashlight for T's. This plugin is allowing both t's and ct's to use a flashlight. I just want Ct's with flashlight :) . I did change it to if(cs_get_user_team(player) == CS_TEAM_CT) but didnt help.
Code:

#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
 
#define PLUGIN "Terrorists are not allowed a flashlight"
#define VERSION "1.0"
#define AUTHOR "Amxmodx community"
 
new bool:can_impulse[32]
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_logevent("round_start", 2, "1=Round_Start")
 
}
 
public round_start()
{
 new players[32], num
 get_players(players, num)
 
 new player
 for(new i = 0; i < num; i++)
 {
  player = players[i]
 
  if(cs_get_user_team(player) == CS_TEAM_CT)
  {
  can_impulse[player] = true
  }
 
  else
  return 1;
 }
 return 1;
}
 
public client_impulse(id,impulse)
{
 if(!can_impulse[id] && impulse == 100)
 {
  return 1;
 }
 return 0;
}



All times are GMT -4. The time now is 21:32.

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