AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Dropping all weapons, not just rifles (https://forums.alliedmods.net/showthread.php?t=29277)

Caesar 06-02-2006 12:16

Dropping all weapons, not just rifles
 
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike>   public plugin_init() {  register_plugin("Frag-check", "1.0", "Caesar")  register_event("CurWeapon", "frag_check", "be") }   public frag_check(id) {  new frags = get_user_frags(id)  new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])    if(frags >= 20)  {   if(weapon != CSW_HEGRENADE || weapon != CSW_FLASHGRENADE || weapon != CSW_SMOKEGRENADE || weapon != CSW_KNIFE || weapon != CSW_P228 || weapon != CSW_KNIFE || weapon != CSW_MAC10 || weapon != CSW_ELITE || weapon != CSW_FIVESEVEN || weapon != CSW_UMP45 || weapon != CSW_USP || weapon != CSW_GLOCK18 || weapon != CSW_MP5NAVY || weapon != CSW_TMP || weapon != CSW_DEAGLE || weapon != CSW_P90)   {    client_print(id, print_chat, "[AMXX] You have too many kills, don't use the good weapons!")    client_cmd(id, "drop")   }   return 1  }  return 1 }

What I am trying to do is make it so once you have 20 kills or more then it makes you drop your weapon, but it is dropping all weapons.

Any help please?

VEN 06-02-2006 12:26

Code:
client_cmd(id, "drop", weapon)

Weapon is a name of weapon, for example, "weapon_usp"
You can retrieve it like so:
Code:
new weapon[20] get_weaponname(CSW_USP, weapon, 20)

JohnJ3 06-02-2006 13:36

Try to use this function:
Code:

//writing by JohnJ
#define W_NONE 0
#define W_PRIMARY 1
#define W_SECONDARY 2
#define W_KNIFE 3
#define W_GRENADE 4
#define W_BOMB 5

wf_get_weap_range(wp)
{
 new name[24], len=23

 if ((wp==CSW_SCOUT) || (wp==CSW_XM1014) || (wp==CSW_MAC10) || (wp==CSW_AUG) || (wp==CSW_UMP45) || (wp==CSW_SG550) || (wp==CSW_GALIL) || (wp==CSW_FAMAS) || (wp==CSW_AWP) || (wp==CSW_MP5NAVY) || (wp==CSW_M249) || (wp==CSW_M3) || (wp==CSW_M4A1) || (wp==CSW_TMP) || (wp==CSW_G3SG1) || (wp==CSW_SG552) || (wp==CSW_AK47) || (wp==CSW_P90))
      {
      return W_PRIMARY
      }
      else if ((wp==CSW_P228) || (wp==CSW_ELITE) || (CSW_FIVESEVEN) || (wp==CSW_USP) || (wp==CSW_GLOCK18) || (wp==CSW_TMP) || (wp==CSW_DEAGLE))
      {
      return W_SECONDARY
      }
      else if (wp==CSW_KNIFE)
      {
      return W_KNIFE
      }
      else if ((wp==CSW_HEGRENADE) || (wp==CSW_SMOKEGRENADE) || (wp==CSW_FLASHBANG))
      {
      return W_GRENADE
      }
      else if (wp==CSW_C4)
      {
      return W_BOMB
      }
      else
      {
      return W_NONE
      }
}



All times are GMT -4. The time now is 16:31.

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