Raised This Month: $ Target: $400
 0% 

Log Event Bomb Drop [SOLVED]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
The Specialist
BANNED
Join Date: Nov 2006
Old 11-21-2006 , 05:28   Log Event Bomb Drop [SOLVED]
Reply With Quote #1

Ok, I am adding an update to my "Follow The Bomb" plugin , a suggestion was made by K007 to add a punsihemnt for droppign the bomb. I used a log event to detect the bomb being dropped but theres no message or punsihing happening when i drop the bomb . any ideas whats wrong .
Code:
#include <amxmodx> #include <engine> #include <fun> #include <cstrike> // Global Variables new g_iFollow_Bomb; new g_iPunish; new  g_iRadius; new g_Mode[8]; new Float:c4origin[3]; new  Float:pOrigin[3]; new players[32], num, i; public plugin_init() {     register_plugin("Follow The Bomber","0.7","The Speicialist");     register_event("ResetHUD","reset_hud","be");     register_event("BarTime", "bomb_planting", "be", "1=3");     register_logevent("bomb_is_planted", 3, "2=Planted_The_Bomb");     register_logevent("bomb_is_dropped", 3, "2=Dropped_The_Bomb");     g_iFollow_Bomb = register_cvar("ftb_switch","1");     g_iPunish = register_cvar("ftb_punishment","a");     g_iRadius = register_cvar("ftb_radius","1000");     set_task(2.0,"find_bomb",0,"",0,"b"); } // reset hud event public reset_hud(id) {       // show message to follow the bomb terrorists         if( cs_get_user_team(id) == CS_TEAM_T  &&  find_ent_by_class(-1 , "weapon_c4"))     {         set_hudmessage(255, 255, 255, -1.0, 0.38, 0, 6.0, 12.0);         show_hudmessage(id, "Follow The Bomb");     } } // find bomb and players in and out of range public find_bomb(id) {     // find the bomb         new g_iBomb = find_ent_by_class(-1,"weapon_c4");         // if cvar is off OR if there is no bomb end function         if(get_pcvar_num(g_iFollow_Bomb)==0 || g_iBomb == 0)     {         return PLUGIN_HANDLED;     }else{              // find the origin of the bomb                 entity_get_vector(g_iBomb,EV_VEC_origin,c4origin);         // get all terrorists                 get_players(players,num,"ace","TERRORIST");         for(i=0;i<num;i++)         {             // find the origin of alive terrorists                         entity_get_vector(players[i],EV_VEC_origin,pOrigin);                         // get distance from alive t's to the bomb                         new Float:  g_Dist = get_distance_f(c4origin,pOrigin);                         new g_iDist = floatround(g_Dist);                         // show hud display of how far you are from the bomb                         set_hudmessage(255, 255, 255, -1.0, 0.79, 0, 6.0, 2.0);             show_hudmessage(id, "You Are %i Units From The Bomb",g_iDist);                         // if alive terrorists are out of range then punish             if( g_Dist > get_pcvar_num(g_iRadius))             {                 punish_mode(players[i]);             }         }     }     return PLUGIN_HANDLED; } // punishment function public punish_mode(players) {     // get string for cvars         get_pcvar_string(g_iPunish,g_Mode,7);         // read flags from string cvar         new g_iMode = read_flags(g_Mode);     new g_iArmor = get_user_armor(players);     new g_iMoney = cs_get_user_money(players);     new g_iHealth = get_user_health(players);         // dispaly hud messages for leaving bomb         set_hudmessage(255, 255, 255, -1.0, 0.34, 0, 6.0, 2.0);     show_hudmessage(players, "Your Leaving The Bomb");         // punish based on flags from cvar string         if(g_iMode  & 1 )  // flag a     {         // slap the user                   user_slap(players,0);     }     if(g_iMode  &  2 )  // flag b     {         // -1 armor from user                 set_user_armor(players,(g_iArmor - 1));     }     if(g_iMode  & 4 )  // flag c     {         // strip the weapons from that user                 strip_user_weapons(players);     }     if(g_iMode & 8 ) // flag d     {         // take away money from user                 cs_set_user_money(players,(g_iMoney - 10));     }     if(g_iMode & 16)  // flag e     {               // kill the user                 user_kill(players);     }           if(g_iMode  & 32 ) // flag f     {         // no punishment                 return PLUGIN_HANDLED;     }     if(g_iMode & 64) // flag g     {         // take 1 health from user                 set_user_health(players,(g_iHealth - 1));     }     return PLUGIN_HANDLED; } // bar time  event detects planting public bomb_planting(id) {     // get user who is planting the bomb     new i;     new g_Name[32];         get_user_name(id,g_Name,31);         // get alive terrorist         get_players(players,num,"ace","TERRORIST");         for(i = 0; i < num ; ++i)     {         // display message to alive terroist             set_hudmessage(255, 255, 255, -1.0, 0.35, 0, 6.0, 12.0);         show_hudmessage(id, "%s Is Planting The Bomb Cover Him!",g_Name);         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; } // logevent cathces bomb is planted message public bomb_is_planted(id) {     // get alive terrorist         get_players(players,num,"ace","TERRORIST");         for(i = 0; i < num ; ++i)     {         // display message to alive terroist             set_hudmessage(255, 255, 255, -1.0, 0.34, 0, 6.0, 12.0);         show_hudmessage(id, "Bomb Is Planted Defend It !");         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; } // detects if the bomb was dropped public bomb_is_dropped(players) {     if(get_pcvar_num(g_iFollow_Bomb)==1)     {         punish_mode(players);                       // display mssage to who ever dropped teh bomb                 set_hudmessage(255, 255, 255, -1.0, 0.34, 0, 6.0, 12.0);         show_hudmessage(players, "Pick The Bomb Back Up !");     } }

thank you for your help

Last edited by The Specialist; 11-21-2006 at 21:34.
The Specialist is offline
Send a message via AIM to The Specialist
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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