AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Force a player to pull out his/her primary (https://forums.alliedmods.net/showthread.php?t=64824)

flyeni6 12-25-2007 13:35

Force a player to pull out his/her primary
 
how do you force a player to pull out his/ her primary weapon when after an event?

Alka 12-25-2007 14:49

Re: Force a player to pull out his/her primary
 
I think i'll do something like this
Code:

#include <amxmodx>
 
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Unknown"
 
#define PRIMARY_WEAPONS ((1<<CSW_SCOUT) | (1<<CSW_XM1014) | (1<<CSW_MAC10) | (1<<CSW_AUG) | (1<<CSW_UMP45) | (1<<CSW_SG550) | (1<<CSW_GALIL) | (1<<CSW_FAMAS) | (1<<CSW_AWP) | (1<<CSW_MP5NAVY) | (1<<CSW_M249) | (1<<CSW_M3) | (1<<CSW_M4A1) | (1<<CSW_TMP) | (1<<CSW_G3SG1) | (1<<CSW_SG552) | (1<<CSW_AK47) | (1<<CSW_P90))
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 //register_event().
}
 
public event()
{
 static Players[32], Num;
 static Player;
 get_players(Players, Num, "ach");
 
 for(new i = 0 ; i < Num ; i++)
 {
  Player = Players[i];
 
  static Weapons[32], WpnNum;
  get_user_weapons(Player, Weapons, WpnNum);
 
  for(new j = 0 ; j < WpnNum ; j++)
  {
  if(PRIMARY_WEAPONS & ( 1 << Weapons[j]))
  {
    static WpnName[32];
    get_weaponname(Weapons[j], WpnName, sizeof WpnName - 1);
 
    engclient_cmd(Player, WpnName);
  }
  }
 }
}


teame06 12-25-2007 16:05

Re: Force a player to pull out his/her primary
 
I would just do

Code:
engclient_cmd(client, "slot2");

IIRC slot2 was the primary weapon.

ConnorMcLeod 12-25-2007 16:09

Re: Force a player to pull out his/her primary
 
Quote:

Originally Posted by teame06 (Post 566768)
I would just do

Code:
engclient_cmd(client, "slot2");

IIRC slot2 was the primary weapon.

It's slot1 but player will select weapon only if his cvar hud_fastwitch is 1.

@alka
Command "use weapon_XXX" is for source.

Code:
if(PRIMARY_WEAPONS & ( 1 << Weapons[j])) {   static WpnName[32];   get_weaponname(Weapons[j], WpnName, sizeof WpnName - 1);     engclient_cmd(Player, WpnName);   return }

Alka 12-26-2007 05:17

Re: Force a player to pull out his/her primary
 
Eh, just a little thingy...:D

flyeni6 12-29-2007 01:26

Re: Force a player to pull out his/her primary
 
i cant seem to get any of these working


All times are GMT -4. The time now is 11:00.

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