AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   only the primarz weapon ?? (https://forums.alliedmods.net/showthread.php?t=20556)

ch3cker 11-11-2005 15:12

only the primarz weapon ??
 
is there a way to force the players to use just the primary weapon ???

v3x 11-11-2005 16:48

This should let the player use only primary weapons and the knife:
Code:
#include <amxmodx> public plugin_init() {   register_event("CurWeapon", "Check_Weapon", "be"); } #define MAX_PRIMARY 19 new bool:g_bPrimary[33]; new g_szPrimary[MAX_PRIMARY][] = {   "weapon_m4a1","weapon_galil",   "weapon_ak47","weapon_scout",   "weapon_sg552","weapon_awp",   "weapon_g3sg1","weapon_famas",   "weapon_aug","weapon_sg550",   "weapon_m3","weapon_xm1014",   "weapon_mac10","weapon_mp5navy",   "weapon_ump45","weapon_tmp",   "weapon_p90","weapon_m249",   "weapon_knife" } public Check_Weapon( id ) {   new clip, ammo, weapon = get_user_weapon(id,clip,ammo);   new szWeapName[33];   get_weaponname(weapon, szWeapName, 32);   g_bPrimary[id] = false;   for(new i = 0; i < MAX_PRIMARY; i++)   {     if(equali(szWeapName, g_szPrimary[i]))       g_bPrimary[id] = true;   }   if(!g_bPrimary[id])   {     for(new i = 0; i < MAX_PRIMARY; i++)     {       if(equali(szWeapName, g_szPrimary[i]))         client_cmd(id, "%s", g_szPrimary[i]);       else         client_cmd(id, "weapon_knife");     }   } }
Untested

If there's a better way, lemme know.

ch3cker 11-12-2005 05:58

ok thx
i will test it

ch3cker 11-12-2005 06:03

you can just use the knife no other weapons
it should be possible that you can use the grenades too

ch3cker 11-13-2005 07:45

vex plz help :roll: :roll: :roll:

XxAvalanchexX 11-13-2005 12:56

Change this:

Code:
 new szWeapName[33];  get_weaponname(id, szWeapName, 32);

Into this:

Code:
 new clip, ammo, weapon = get_user_weapon(id,clip,ammo);  new szWeapName[33];  get_weaponname(weapon, szWeapName, 32);

get_weaponname takes a weapon index

v3x 11-13-2005 14:35

Oh, doh.. :D

ch3cker 11-13-2005 16:23

thx guys
it works great
+ karma 4 u


All times are GMT -4. The time now is 23:36.

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