AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   what event keeps regestering (https://forums.alliedmods.net/showthread.php?t=47632)

kp_uparrow 11-22-2006 18:41

what event keeps regestering
 
1 Attachment(s)
what event keeps regestering, like a event the keeps calling a function no matter what the player is doing

jim_yang 11-22-2006 21:45

Re: what event keeps regestering
 
set_task ?

XxAvalanchexX 11-22-2006 21:46

Re: what event keeps regestering
 
server_frame, client_PreThink, client_PostThink, and possibly others. However, there are usually better alternatives, depending on what you are trying to accomplish.

kp_uparrow 11-22-2006 21:57

Re: what event keeps regestering
 
im trying to have the plugin above keep checking players for if they have nade out, what event sould i use?

jim_yang 11-22-2006 22:07

Re: what event keeps regestering
 
sorry, but what does "have nade out" mean ?

XxAvalanchexX 11-22-2006 22:12

Re: what event keeps regestering
 
I would register the CurWeapon event, since it is called when a player changes weapons (or shoots). The first argument sent with it is 1 if this is the weapon they are currently using, 0 if they are switching from this weapon. The second argument is the weapon in question (weapon they are using if first arg is 1, weapon they are switching from is first arg is 0). The last argument is the ammo in the weapon. So, for example:

Code:
register_event("CurWeapon","event_curweapon","b","1=1"); // ... public event_curweapon(id) {      if(read_data(2) != CSW_KNIFE)      {           // do something      } }

jim_yang 11-22-2006 22:20

Re: what event keeps regestering
 
here is my no vote version knife arena.
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Knife Arena" #define VERSION "1.0" #define AUTHOR "Jim" new knifeonly = 0 public plugin_init() {         register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("knife_arena", "knife_arena", ADMIN_LEVEL_A)         register_event("CurWeapon", "knife", "b", "2!29") } public knife_arena(id, level, cid) {         if(!cmd_access(id, level, cid, 2))                 return PLUGIN_HANDLED         new argv[2]         read_argv(1, argv, 1)         new enable = str_to_num(argv)         if(enable != knifeonly) {                 knifeonly = enable                 if(knifeonly) {                         client_cmd(0, "weapon_knife")                         client_print(0, print_chat, "[AMXX] Knife Only Allowed!")                         set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)                         show_hudmessage(0, "Knife Only Allowed")                 }                 else {                         client_print(0, print_chat, "[AMXX] All Weapons Allowed!")                         set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)                         show_hudmessage(0, "All Weapons Allowed")                 }         }         return PLUGIN_HANDLED } public knife(id) {         if (knifeonly)                 engclient_cmd(id, "weapon_knife")         return PLUGIN_CONTINUE }

kp_uparrow 11-22-2006 22:27

Re: what event keeps regestering
 
i currently use curweapon but if client keeps pressing 4 44444 4 4 4 44444 then they can hold the nade and throw it

SweatyBanana 11-24-2006 00:57

Re: what event keeps regestering
 
use engclient_cmd instead of client_cmd.


All times are GMT -4. The time now is 06:58.

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