Am decis sa fac urmatorul tutorial deoarece sunt multi care vor probabil sa-si faca un plugin cu evenimentele despre C4
Ce inseamna asta ?
R: De exemplu vrei sa determini cand cineva a pus bomba deoarece vrei sa pui sa cante o melodie, sau cand cineva o scapa sa pateasca ceva, sa anunte ceva si tot asa mai departe.
In primul rand, acest tutorial este valabil doar pentru amxmodx 1.76 sau mai nou ; Deoarece vom avea nevoie de ultima versiune de "CSX"
Si cum spuneam, CSX de la amxmodx 1.76 a venit cu 5 forwarduri foarte folositoare:
1) - bomb_planted
2) - bomb_defused
3) - bomb_planting
4) - bomb_defusing
5) - bomb_explode
Si un exemplu :
public bomb_planted(id)
{
new name[32]
get_user_name(id,name,31)
set_hudmessage(255, 0, 0, 0.3.0, 0.15, 0, 6.0, 5.0)
show_hudmessage0, "%s set us up the bomb !", name)
// sau alt ceva ce vreti voi sa faca sa-i dea bani, sa explodeze etc
}
Intreg pluginul :
#include <amxmodx>
#include <amxmisc>
#include <csx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "SAMURAI"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public bomb_planted(id)
{
new name[32]
get_user_name(id,name,31)
set_hudmessage(255, 0, 0, 0.3.0, 0.15, 0, 6.0, 5.0)
show_hudmessage0, "%s set us up the bomb !", name)
// sau alt ceva ce vreti voi sa faca sa-i dea bani, sa explodeze etc
}
Ei bine pentru bomb_defused de ex:
public bomb_defused(id)
{
new name[32]
get_user_name(id,name,31)
set_hudmessage(255, 0, 0, 0.3.0, 0.15, 0, 6.0, 5.0)
show_hudmessage0, "%s defused the bomb !", name)
// stuff :p
}
Intreg pluginul:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "SAMURAI"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public bomb_defused(id)
{
new name[32]
get_user_name(id,name,31)
set_hudmessage(255, 0, 0, 0.3.0, 0.15, 0, 6.0, 5.0)
show_hudmessage0, "%s defused the bomb !", name)
// stuff :p
}
ei bine dar CSX are din pacate doar cateva functii . Dar daca vreau sa aflu cand a scapat cineva bomba ? ei bine uite cum:
In primul rand publicul trebuie inregistrat printr-un event:
1) Bomb Pickup : "2&#Got_bomb"
2) Bomb Drop : 2&#Game_bomb_d"
Aceste evenimente se inregistrea la public plugin_init prin functia register_event.
Si vine cam asa:
register_event("TextMsg", "nume public", "bc", "2&#Got_bomb")
si:
register_event("TextMsg", "bomb_drop", "bc", "2&#Game_bomb_d")
Ei bine un exemplu complet de pickup:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "SAMURAI"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("TextMsg", "bomb_pickup", "bc", "2&#Got_bomb")
}
public bomb_pickup(id)
{
new name[32]
get_user_name(id,name,31)
set_hudmessage(255, 0, 0, 0.3.0, 0.15, 0, 6.0, 5.0)
show_hudmessage0, "%s pick up the bomb", name)
// stuff :p
}
Sper ca ati inteles . o.O