AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to force a weapon. (https://forums.alliedmods.net/showthread.php?t=47084)

mateo10 11-09-2006 14:35

How to force a weapon.
 
Hi,

I wonder how you should force a weapon to all users when a round starts.

This is a plugin i made for myself but i dont think it forces it every round start:

Code:
#include <amxmodx> #include <cstrike> #include <fun> public plugin_init() {     register_plugin("weapons", "1.00", "MaTTe")     register_cvar("sv_weapons", "1")     register_cvar("sv_weaponstimer", "1")     set_task(get_cvar_float("sv_weaponstimer"), "giveWeapon") } public giveWeapon(id) {     new CsTeams:iTeam = cs_get_user_team(id)     switch(iTeam)     {         case CS_TEAM_T:         {             if(get_cvar_num("sv_weapons")==0)             {             client_print(id, print_chat, "The plugin is closed by an administrator."             }             else             {             give_item(id, "weapon_ak47")             }         }         case CS_TEAM_CT:         {             if(get_cvar_num("sv_weapons")==0)             {             client_print(id, print_chat, "The plugin is closed by an administrator."             }             else             {             give_item(id, "weapon_m4a1")             }         }     }     set_task(get_cvar_float("sv_weaponstimer"), "giveWeapon") }

ch3cker 11-09-2006 18:10

Re: How to force a weapon.
 
im not so good at scripting but i think you should look @ http://forums.alliedmods.net/showthread.php?t=42159

i think you should use
Code:
register_event("HLTV", "giveWeapon", "a", "1=0", "2=0")

in plugin_init

I hope this is correctly.

The Specialist 11-09-2006 18:48

Re: How to force a weapon.
 
here this will givve all players a m4a1 on player spawn
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define MAX_PLAYERS 32 new bool:g_restart_attempt[MAX_PLAYERS + 1] public plugin_init() {  register_plugin("give_weapon","1.0","The Specialist");  register_event("ResetHUD", "event_hud_reset", "be")  register_clcmd("fullupdate", "clcmd_fullupdate")  register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in") } public clcmd_fullupdate() {  return PLUGIN_HANDLED } public event_restart_attempt()  {  new players[32], num  get_players(players, num, "a")  for (new i; i < num; ++i)   g_restart_attempt[players[i]] = true } public event_hud_reset(id)  {  if (g_restart_attempt[id])  {   g_restart_attempt[id] = false   return  }    event_player_spawn(id) } // this function is called on player spawn public event_player_spawn(id) {  give_item(id, "weapon_m4a1"); }


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

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