AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Passing ID from event to event without execution of second event (https://forums.alliedmods.net/showthread.php?t=46384)

Rolnaaba 10-25-2006 10:09

Passing ID from event to event without execution of second event
 
how to pass an ID from one event to another without activating the second event at the time of passing so the event will be called normally?
e.i.:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("DeathMsg", "Death", "a")     register_event("HLTV", "event_new_round", "a", "1=0", "2=0") } public Death() {     new killer = read_data(2) } public event_new_round() {     //how to pass the ID variable "killer"     //to this func without activating it until     //it is called upon naturally? }

schnitzelmaker 10-25-2006 11:25

Re: Passing ID from event to event without execution of second event
 
A way is using a global variable as temp.This Plugin store the last killer for every player,until "event_new_round".
Code:
#include <amxmodx> #include <amxmisc> new tempkiller[33] public plugin_init() {      register_plugin(PLUGIN, VERSION, AUTHOR)      register_event("DeathMsg", "Death", "a")      register_event("HLTV", "event_new_round", "a", "1=0", "2=0") } public Death() {      new killer = read_data(2)      tempkiller[killer] = killer } public event_new_round() {      for(new i=0;i<=get_maxplayers();i++)      {           new killer = tempkiller[i]           tempkiller[i]=0           if(is_user_connected(i) && killer)           {               //do anything with killer           }      } }

Rolnaaba 10-25-2006 12:36

Re: Passing ID from event to event without execution of second event
 
wow thanks a lot man helped me out ;) +karma


All times are GMT -4. The time now is 04:55.

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