/***************************************************************************\
=====================================
* || [ZP] Antidote || *
* || Version 1.2 || *
=====================================
-------------------
*||DESCRIPTION||*
-------------------
Plugin add Antidote item to Zombie Plague Special Server,you can buy on extraitem menu
or pick up from dead players, controlled by cvar from wich. Also controlled wich dead
body will drop. When Buy you will be disinfect immediately, but if pickup, you can will
activate later with command.
Item have some limit:
- Use/Buy limited by cvar on single round.
- Pickup limited by cvar on single round.
- Use is limited depending on the number of zombies by cvar.
Cvar minimum value 2(checkin always mapchange)
- Use/buy limit on map
Default Price 70 Ammo.
ITEM WILL DISABLE ORIGINALLY ANTIDOTE ITEM ON ZP SERVER!!
-------------------
*|| COMMANDS ||*
-------------------
-----------------------------------------------------------------------
+antidote - console command for use item
/antidote - chat command for use item
say antidote - show little info on chat
-------------------
*|| CVARS ||*
-------------------
-----------------------------------------------------------------------
********************************
* Buy & Use limit for item on single
*
* INT 'INT' value item can buy on single round
zp_anti_use_rlimit 3 (default)
********************************
* Pick up limit for item on single round
*
* INT 'INT' value item can pickup on single round
zp_anti_pick_rlimit 3 (default)
********************************
* Buy & Use limit for item on single
*
* INT 'INT' value item can buy on map
zp_anti_use_mlimit 15 (default)
********************************
* Pick up limit for item on single round
*
* INT 'INT' value item can pickup on map
zp_anti_pick_mlimit 30 (default)
********************************
* Who can pick up this item.
*
* 0|1|2 0: Everybody (except specials)
* 1: Humans (except specials)
* 2: Zombies (except specials)
zp_anti_pickup 0 (default)
*********************************
* Who will drop this item.
*
* 0|1|2 0: Everybody
* 1: Humans
* 2: Zombies
zp_anti_drop 1 (default)
*********************************
* Zombie count limit for use item
*
* INT(>1) Minimum value '2', last zombie can't use
* this item.
zp_anti_minzombie 2 (default)
*********************************
* Show hud information when pick up item
*
* 0|1 0: Disable
* 1: Enable
zp_anti_hud 1 (default)
*********************************
* Show icon when pick up item
*
* 0|1 0: Disable
* 1: Enable
zp_anti_icon 1 (default)
-------------------
*|| NATIVES ||*
-------------------
-----------------------------------------------------------------------
**
* Add item to player
*
* @param id Player index.
* @param item_name[] Set g_item_name (normally 'Antidote') for reach
* @param amount amount of given item
* @param chat set int if want little chat message
* @param hud set int if want little hud message
* @param icon set int if want little icon message
* @param sound set int if want sound
*
* return true if valid player
*
give_item_ex(id,item_name[],amount,chat,hud,icon,sound)
**
* Remove item from player
*
* @param id Player index.
* @param item_name[] Set g_item_name (normally 'Antidote') for reach
* @param amount amount of removed item
* @return true if valid player
*
remove_item_ex(id,item_name[],amount)
**
* Quantity of the item stored in the player
*
* @param id Player index.
* @param item_name[] Set g_item_name (normally 'Antidote') for reach
*
* @return INT -1 if player not valid
*
item_ex_quantity(id,item_name[])
-------------------
*|| FORWARDS ||*
-------------------
-----------------------------------------------------------------------
none
---------------
*||CREDITS||*
---------------
none
------------------
*||CHANGE LOG||*
------------------
v1.0 ====> - Initial Release
v1.1 ====> - Better natives, clean code
-----------------
*||TODO LIST||*
-----------------
- Load bar for use (from scream extra item)
- use limit from zombie min hp
-
\***************************************************************************/
//
#define STATS_TEMP
/*================================================================================
[Includes]
=================================================================================*/
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <zombie_plague_special>
/*================================================================================
[Defines]
=================================================================================*/
#define is_valid_user(%1) (1 <= %1 <= g_maxplayers && is_user_connected(%1))
// Plug info.
new const PLUGIN[] = "[ZP][ITEM][Z] Antidote"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Furion"
/*================================================================================
[CUSTOMIZE SECTION]
=================================================================================*/
new g_item_name[] = "Antidote"
new const g_AntidoteClassname[ ] = "antidote_entity";
new const szModelKit[ ] = "models/zombie_plague/items/ammodrop_red.mdl";
new const szPickupSound[ ] = "zombie_plague/ammodrop.wav";
new const szIcon[] = "cross"
#if defined STATS_TEMP
//db_size for temp save increase if need
const MAX_TEMP_SAVE = 64
#endif
/*================================================================================
[global vars]
=================================================================================*/
// Class ID
new g_item_antidote;
new g_maxplayers;
new bool:g_roundlive = false;
//entity spec
enum _: iCoords
{
x = 0,
y,
z
};
new gGMsgItemPickup;
//cvars
#if defined STATS_TEMP
new cvar_antidote_usemaplimit,cvar_antidote_pickupmaplimit
#endif
new cvar_antidote_pickuproundlimit,cvar_antidote_useroundlimit
new cvar_antidote_drop,cvar_antidote_pickup
new cvar_antidote_hud,cvar_antidote_icon,cvar_antidote_minzombie;
#if defined STATS_TEMP
new g_pcvar_antidote_usemaplimit,g_pcvar_antidote_pickupmaplimit
#endif
new g_pcvar_antidote_pickuproundlimit ,g_pcvar_antidote_useroundlimit
new g_pcvar_antidote_pickup ,g_pcvar_antidote_drop
new g_pcvar_antidote_hud,g_pcvar_antidote_icon,g_pcvar_antidote_minzombie;
//player specific
#if defined STATS_TEMP
new g_AntiUsedOnMap[33],g_AntiPickedOnMap[33]
#endif
new g_antidote[33], g_AntiUsedOnRound[33],g_AntiPickedOnRound[33]
new bool:g_info[33]
#if defined STATS_TEMP
// Temporary Database vars (used to restore players stats in case they get disconnected)
new g_steamid[33][35]
new db_steamid[MAX_TEMP_SAVE][35], db_antidote[MAX_TEMP_SAVE], db_pickedonmap[MAX_TEMP_SAVE],db_usedonmap[MAX_TEMP_SAVE]
new Float:db_time[MAX_TEMP_SAVE]
#endif
/*================================================================================
[Init, CFG and Precache]
=================================================================================*/
public plugin_precache()
{
cvar_antidote_useroundlimit = create_cvar("zp_anti_use_rlimit","3", FCVAR_NONE, "Buy/Use antidote round limit for one player^n\
ONLY infection & multi infection can buy & use^n\
0 - can't buy & can't use^n\
INT - limit value")
cvar_antidote_pickuproundlimit = create_cvar("zp_anti_pick_rlimit","3", FCVAR_NONE, "Pick up antidote round limit for one player^n\
EVERY round can pick up antidote^n\
0 - can't pick up (no drop)^n\
INT - limit for pick up on single round")
#if defined STATS_TEMP
cvar_antidote_usemaplimit = create_cvar("zp_anti_use_mlimit","15", FCVAR_NONE, "Buy/Use antidote map limit for one player^n\
ONLY infection & multi infection can buy & use^n\
0 - can't buy & can't use (no drop)^n\
INT - use limit")
cvar_antidote_pickupmaplimit = create_cvar("zp_anti_pick_mlimit","30", FCVAR_NONE, "Pick up antidote map limit for one player^n\
EVERY round can pick up antidote^n\
0 - can't pick up (no drop)^n\
INT - pick up limit")
#endif
cvar_antidote_pickup = create_cvar("zp_anti_pickup","0", FCVAR_NONE, "Who can pick up antidote?^n\
0 - All player(specials not)^n\
1 - Only humans (specials not)^n\
2 - Only Zombies (specials not)")
cvar_antidote_drop = create_cvar("zp_anti_drop","1", FCVAR_NONE, "Wich dead body drop antidote?^n\
0 - All ^n\
1 - Only humans ^n\
2 - Only Zombies")
cvar_antidote_minzombie = create_cvar( "zp_anti_minzombie", "3", FCVAR_NONE, "Zombie count limit for (only) use^n\ (minimum 2)")
cvar_antidote_hud = create_cvar( "zp_anti_hud", "1", FCVAR_NONE, "HUD information ON/OFF antidote pickup^n\
0 - off^n\
1 - on")
cvar_antidote_icon = create_cvar( "zp_anti_icon", "1", FCVAR_NONE, "Icon information ON/OFF antidote pickup^n\
0 - off^n\
1 - on")
precache_model( szModelKit );
precache_sound( szPickupSound );
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
//commands
register_clcmd("say /antidote", "cmdAntidote",_,"Use antidote")
register_clcmd("+antidote", "cmdAntidote",_,"Use antidote")
register_clcmd("say antidote", "cmdAntidoteHelp",_,"Antidote info")
//cvars
g_pcvar_antidote_useroundlimit = get_pcvar_num(cvar_antidote_useroundlimit)
g_pcvar_antidote_pickuproundlimit = get_pcvar_num(cvar_antidote_pickuproundlimit)
#if defined STATS_TEMP
g_pcvar_antidote_usemaplimit = get_pcvar_num(cvar_antidote_usemaplimit)
g_pcvar_antidote_pickupmaplimit = get_pcvar_num(cvar_antidote_pickupmaplimit)
#endif
g_pcvar_antidote_pickup = get_pcvar_num(cvar_antidote_pickup)
g_pcvar_antidote_drop = get_pcvar_num(cvar_antidote_drop)
g_pcvar_antidote_minzombie = get_pcvar_num(cvar_antidote_minzombie)
if (g_pcvar_antidote_minzombie < 2) {
g_pcvar_antidote_minzombie = 2
}
g_pcvar_antidote_hud = get_pcvar_num( cvar_antidote_hud );
g_pcvar_antidote_icon = get_pcvar_num( cvar_antidote_icon );
//events
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("DeathMsg", "Death", "a")
//variables
gGMsgItemPickup = get_user_msgid( "ItemPickup" );
g_maxplayers = get_maxplayers()
//register extra item
g_item_antidote = zp_register_extra_item(g_item_name, 70, ZP_TEAM_ZOMBIE)
//forwards
register_forward( FM_Touch, "forward_FM_Touch" );
}
public plugin_cfg()
{//check original zp_extra antidote and disable
new const cvarname[] = "zp_extra_antidote"
new i_zp_pointer = get_cvar_pointer(cvarname)
if(i_zp_pointer)
{
new iOldValue
iOldValue = get_pcvar_num(i_zp_pointer)
if (iOldValue)
{
set_pcvar_num(i_zp_pointer,0)
log_amx(" <WARNING> ***original '%s' set %i from %i***",cvarname,get_pcvar_num(i_zp_pointer),iOldValue)
}
}
}
public plugin_natives()
{
register_native("give_item_ex", "native_give_item_ex", 1)
register_native("remove_item_ex", "native_remove_item_ex", 1)
register_native("use_item_ex", "native_use_item_ex", 1)// force to use jut if he not limited
register_native("item_ex_quantity", "native_item_ex_quantity", 1)
}
public native_give_item_ex(id,item_name[],amount,hud,icon,sound) //ez a táska és a ládás rendszerhezz kell(sql load, vagy a ládából nyer)
{
if (!is_valid_user(id))
return false;
if (equal(item_name,g_item_name))
{
if(!amount) g_antidote[id]++;
else g_antidote[id] += amount;
if(g_info[id] == false)
{
client_print_color(id ,print_team_default, "^4 Felvettél egy ellenszert. További információkért írd be chatben az '^1antidote^4' szót")
g_info[id] = true
}
if (hud && g_pcvar_antidote_hud)
{
set_hudmessage( 0, 125, 250, -1.0, 0.4, 2, 6.0, 3.0 );
show_hudmessage( id, "antidote (%d)",g_antidote[id]);
}
if (icon && g_pcvar_antidote_icon ) UTIL_Send_PickupMessage( id, szIcon );
if(sound)
{
emit_sound( id, CHAN_ITEM, szPickupSound, VOL_NORM, ATTN_NORM, 0 , PITCH_NORM );
}
return true;
}
return false;
}
public native_remove_item_ex(id,item_name[],amount) //ez a táska rendszerhez kell csak, ott is a mentéshez **** itt nem használja, csak elveszi
{
if (!is_valid_user(id))
return false;
if (equal(item_name,g_item_name))
{
if(amount) ((g_antidote[id] >= amount) ? (g_antidote[id] -= amount) : (g_antidote[id] = 0));
else
{
if(g_antidote[id] > 0) g_antidote[id]--
else g_antidote[id] = 0
}
return true;
}
return false
}
public native_use_item_ex(id,item_name[]) //táska rendszernél a menüből kiválasztás után ennek kell lefutnia ******használja de nem veszi el!
{
if (!is_valid_user(id))
return false;
if (equal(item_name,g_item_name) && g_antidote[id] > 0 )
{
if (g_pcvar_antidote_useroundlimit == 0 ) return false
else if (g_AntiUsedOnRound[id] >= g_pcvar_antidote_useroundlimit ) return false
#if defined STATS_TEMP
else if (g_pcvar_antidote_usemaplimit == 0 ) return false
else if (g_AntiUsedOnMap[id] >= g_pcvar_antidote_usemaplimit ) return false
#endif
else if (zp_get_zombie_special_class(id) ) return false
else if (g_roundlive == false) return false
else if ( !(zp_is_infection_round() || zp_is_multi_round()) ) return false
else if (zp_get_zombie_count() < g_pcvar_antidote_minzombie ) return false
else
{
#if defined STATS_TEMP
g_AntiUsedOnMap[id]++
#endif
g_AntiUsedOnRound[id] ++
zp_disinfect_user(id,0);
return true
}
}
return false
}
public native_item_ex_quantity(id,item_name[])//táska rendszernél a menühöz le tudja kérni a mennyiséget
{
if (!is_valid_user(id))
return -1;
if (equal(item_name,g_item_name))
return g_antidote[id];
else return 0
}
/*================================================================================
[MAIN AMX & ZP FUNCTIONS]
=================================================================================*/
public zp_extra_item_selected_pre(id, itemid)
{
if (itemid == g_item_antidote)
{
if (g_pcvar_antidote_useroundlimit == 0 ) return ZP_PLUGIN_SUPERCEDE
if (g_AntiUsedOnRound[id] >= g_pcvar_antidote_useroundlimit ) return ZP_PLUGIN_HANDLED
#if defined STATS_TEMP
if ( g_pcvar_antidote_usemaplimit == 0) return ZP_PLUGIN_SUPERCEDE
if (g_AntiUsedOnMap[id] >= g_pcvar_antidote_usemaplimit ) return ZP_PLUGIN_HANDLED
#endif
if (zp_get_zombie_special_class(id) ) return ZP_PLUGIN_HANDLED
if (g_roundlive == false) return ZP_PLUGIN_HANDLED
if ( !(zp_is_infection_round() || zp_is_multi_round()) ) return ZP_PLUGIN_HANDLED
if (zp_get_zombie_count() < g_pcvar_antidote_minzombie ) return ZP_PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public zp_extra_item_selected(id, item)
{
if(item == g_item_antidote )
{
if (g_pcvar_antidote_useroundlimit == 0 ) return ZP_PLUGIN_HANDLED
else if (g_AntiUsedOnRound[id] >= g_pcvar_antidote_useroundlimit ) return ZP_PLUGIN_HANDLED
#if defined STATS_TEMP
else if (g_pcvar_antidote_usemaplimit == 0 ) return ZP_PLUGIN_HANDLED
else if (g_AntiUsedOnMap[id] >= g_pcvar_antidote_usemaplimit ) return ZP_PLUGIN_HANDLED
#endif
else if (zp_get_zombie_special_class(id) ) return ZP_PLUGIN_HANDLED
else if (g_roundlive == false) return ZP_PLUGIN_HANDLED
else if ( !(zp_is_infection_round() || zp_is_multi_round()) ) return ZP_PLUGIN_HANDLED
else if (zp_get_zombie_count() < g_pcvar_antidote_minzombie ) return ZP_PLUGIN_HANDLED
else
{
#if defined STATS_TEMP
g_AntiUsedOnMap[id]++
#endif
g_AntiUsedOnRound[id] ++
zp_disinfect_user(id,0);
}
}
return PLUGIN_HANDLED
}
public client_connect(id)
{
g_antidote[id] = 0
g_AntiUsedOnRound[id] = 0
g_AntiPickedOnRound[id] = 0
g_info[id] = false
#if defined STATS_TEMP
g_AntiUsedOnMap[id] = 0
g_AntiPickedOnMap[id] = 0
if (!is_user_hltv(id))
{
(is_user_bot(id)) ? (get_user_name(id, g_steamid[id], charsmax(g_steamid[]))) : (get_user_authid(id, g_steamid[id], charsmax(g_steamid[])))
load_stats(id)
}
#endif
}
public client_disconnected(id)
{
#if defined STATS_TEMP
if (!is_user_hltv(id))
{
(is_user_bot(id)) ? (get_user_name(id, g_steamid[id], charsmax(g_steamid[]))) : (get_user_authid(id, g_steamid[id], charsmax(g_steamid[])))
save_stats(id)
}
//else get_user_name(id, g_steamid[id], charsmax(g_steamid[]))
g_steamid[id][0] = EOS
#endif
g_antidote[id] = 0
g_AntiUsedOnRound[id] = 0
g_AntiPickedOnRound[id] = 0
}
public Death(const victim, const killer, iGib)
{
new victim = read_data(2)
new killer = read_data(1)
if (!is_valid_user(victim) || !is_valid_user(killer) ) return PLUGIN_HANDLED;
if (victim == killer) return PLUGIN_HANDLED;
if (g_pcvar_antidote_pickuproundlimit == 0 ) return PLUGIN_HANDLED
#if defined STATS_TEMP
if (g_pcvar_antidote_pickupmaplimit == 0 ) return PLUGIN_HANDLED
#endif
if (zp_get_user_zombie(victim) && g_pcvar_antidote_drop == 2 )return PLUGIN_HANDLED
if (!zp_get_user_zombie(victim) && g_pcvar_antidote_drop == 1 )return PLUGIN_HANDLED
new ran = random_num(0,2)
if (!ran)
{
static Float:flOrigin[ iCoords ];
pev( victim, pev_origin, flOrigin );
new iEnt = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
/* --| Modify the origin a little bit. This is calculated to be set on floor */
flOrigin[ z ] -= 39;
flOrigin[ x ] += 3;
flOrigin[ x ] -= 3;
engfunc( EngFunc_SetOrigin, iEnt, flOrigin );
if( !pev_valid( iEnt ) )
{
return PLUGIN_HANDLED;
}
set_pev( iEnt, pev_classname, g_AntidoteClassname );
engfunc( EngFunc_SetModel, iEnt, szModelKit );
dllfunc( DLLFunc_Spawn, iEnt );
set_pev( iEnt, pev_solid, SOLID_TRIGGER );
set_pev( iEnt, pev_movetype, MOVETYPE_NONE );
engfunc( EngFunc_SetSize, iEnt, Float:{ -3.160000, -3.660000, -0.050000 }, Float:{ 3.470000, 1.780000, 3.720000 } ); //Float:{ -3.160000, -3.660000, -0.050000 }, Float:{ 11.470000, 12.780000, 6.720000 } );
engfunc( EngFunc_DropToFloor, iEnt );
}
return PLUGIN_HANDLED;
}
public event_round_start()
{
for (new id; id <= g_maxplayers; id++)
{
if (is_user_connected(id))
{
g_AntiUsedOnRound[id] = 0
g_AntiPickedOnRound[id] = 0
}
}
new iEntity = FM_NULLENT;
while( ( iEntity = fm_find_ent_by_class( iEntity, g_AntidoteClassname ) ) )
{
engfunc( EngFunc_RemoveEntity, iEntity );
}
}
public zp_round_started()
{
g_roundlive = true
}
public zp_round_ended(winteam)
{
g_roundlive = false
}
/*================================================================================
[ANTIDOTE FUNCTIONS]
=================================================================================*/
public cmdAntidoteHelp(id)
{
if (!is_valid_user(id) ) return PLUGIN_HANDLED
client_print_color(id ,print_team_default, "^4Ellenszert az 'Extra eszközök' menüben vásárolhatsz vagy véletlenszerűen találhatsz a halottaknál. A menüben vásárolt^1")
client_print_color(id ,print_team_default, "^4 azonnal aktiválódik, amit felveszel azt később az '^1/antidote^4' paranccsal aktiválhatod a chatben,^1")
client_print_color(id ,print_team_default, "^4 vagy hozzárendelhetsz egy billentyűt a '^1+antidote^4' parancshoz. Jelenleg '%i' ellenszered van^1",native_item_ex_quantity(id,g_item_name))
client_print_color(id ,print_team_default, "^4 Csak Normál vagy többszörös fertőzés módban használható!!!^1")
return PLUGIN_HANDLED
}
public cmdAntidote(id)
{
if (!is_valid_user(id) || !zp_get_user_zombie(id)) return PLUGIN_HANDLED
if (g_pcvar_antidote_useroundlimit == 0 ) return PLUGIN_HANDLED
if ( g_pcvar_antidote_useroundlimit <= g_AntiUsedOnRound[id]) return PLUGIN_HANDLED
#if defined STATS_TEMP
if (g_pcvar_antidote_usemaplimit == 0 ) return PLUGIN_HANDLED
if ( g_pcvar_antidote_usemaplimit <= g_AntiUsedOnMap[id]) return PLUGIN_HANDLED
#endif
if (zp_get_zombie_special_class(id)) return PLUGIN_HANDLED
if (g_roundlive == false) return PLUGIN_HANDLED
if (!(zp_is_infection_round() || zp_is_multi_round())) return PLUGIN_HANDLED
if (zp_get_zombie_count() < g_pcvar_antidote_minzombie ) return PLUGIN_HANDLED
if (g_antidote[id] < 1 ) return PLUGIN_HANDLED
native_remove_item_ex(id,g_item_name,1)
g_AntiUsedOnRound[id] ++
#if defined STATS_TEMP
g_AntiUsedOnMap[id] ++
#endif
zp_disinfect_user(id,0);
return PLUGIN_HANDLED
}
public forward_FM_Touch( iEnt, id )
{
if( !pev_valid( iEnt ) || !is_user_alive(id) || is_user_bot(id) ) return FMRES_IGNORED;
if (g_pcvar_antidote_pickuproundlimit == 0 || g_pcvar_antidote_pickuproundlimit <= g_AntiPickedOnRound[id] ) return FMRES_IGNORED;
#if defined STATS_TEMP
if (g_pcvar_antidote_pickupmaplimit == 0 || g_pcvar_antidote_pickupmaplimit <= g_AntiPickedOnMap[id] ) return FMRES_IGNORED;
#endif
if (zp_get_user_zombie(id) && g_pcvar_antidote_pickup ==1) return FMRES_IGNORED;
if (!zp_get_user_zombie(id) && g_pcvar_antidote_pickup ==2) return FMRES_IGNORED;
new szClassname[ 32 ];
pev( iEnt, pev_classname, szClassname, charsmax( szClassname ) );
if( !equal( szClassname, g_AntidoteClassname ) ) return FMRES_IGNORED;
if (!zp_get_zombie_special_class(id) || !zp_get_human_special_class(id) )
{
native_give_item_ex(id,g_item_name,1,1,1,1)
g_AntiPickedOnRound[id]++
#if defined STATS_TEMP
g_AntiPickedOnMap[id] ++
#endif
engfunc( EngFunc_RemoveEntity, iEnt );
}
return FMRES_IGNORED;
}
/*================================================================================
[TEMPORARY SAVE-LOAD FUNCTIONS]
=================================================================================*/
#if defined STATS_TEMP
load_stats(id)
{
// Look for a matching record
static i
for (i = 0; i < sizeof db_steamid; i++)
{
if(equal(g_steamid[id], db_steamid[i]))
{
// Bingo! Load
g_antidote[id] = db_antidote[i]
g_AntiUsedOnMap[id] = db_pickedonmap[i]
g_AntiPickedOnMap[id] = db_usedonmap[i]
return;
}
}
}
save_stats(id)
{
// Look for a matching record
new i
new iOldestSlot = -1
new Float:iTime = get_gametime()
for (i = 0; i < sizeof db_steamid; i++)
{
if (0 < db_time[i] < iTime)
{
iOldestSlot = i
iTime = db_time[i]
}
// matching record, overwrite
if(equal(g_steamid[id], db_steamid[i]) )
{
copy(db_steamid[i], charsmax(db_steamid[]), g_steamid[id])
db_antidote[i] = g_antidote[id]
db_pickedonmap[i] = g_AntiUsedOnMap[id]
db_usedonmap[i] = g_AntiPickedOnMap[id]
db_time[i] = get_gametime()
break;
}
else
{
// slot not empty
if(db_steamid[i][0] )
{
// Last slot, need overwrite oldest slot
if(i == sizeof db_steamid - 1)
{
copy(db_steamid[iOldestSlot], charsmax(db_steamid[]), g_steamid[id])
db_antidote[iOldestSlot] = g_antidote[id]
db_pickedonmap[iOldestSlot] = g_AntiUsedOnMap[id]
db_usedonmap[iOldestSlot] = g_AntiPickedOnMap[id]
db_time[iOldestSlot] = get_gametime()
break;
}
//go next slot
else
{
continue;
}
}
// Empty slot, write data
else
{
copy(db_steamid[i], charsmax(db_steamid[]), g_steamid[id])
db_antidote[i] = g_antidote[id]
db_pickedonmap[i] = g_AntiUsedOnMap[id]
db_usedonmap[i] = g_AntiPickedOnMap[id]
db_time[i] = get_gametime()
break;
}
}
}
}
#endif
/*================================================================================
[Stocks]
=================================================================================*/
stock UTIL_Send_PickupMessage( const id, const szItemName[ ] )
{
message_begin( MSG_ONE_UNRELIABLE, gGMsgItemPickup, _, id );
write_string( szItemName );
message_end( );
}
Az élet játékos oldala
Pawn programozással kapcsolatos anyagok gyűjtőhelye
2020. október 28., szerda
[ZP] Antidote
2020. július 28., kedd
Antirush by Furion V2.83
Antirusher Plugin xPaw féle átdolgozva eddigi teszt: nincs hiba
/*
2.81 - New print functions: - ML Print
- Colored print
- NEW CVAR: - amx_antirusher_messages 2 //0|1|2 - no messages | normal color messages (yellow) | colored messages, in dictionary file you can use !g !t !y
- add some text for map rules(~460)
- New plugin_cfg function
- Cfg file and rush.cor in new directory (inner "configs" dir
2.82 - bugfix task loop duplicated (check_origin & newround)
- Major update rush functionality: - in AS_ map when VIP touch the terrorist rush borders then allow rush
- in CS_ maps when CT touched the hostage then allow rush
- in DE_ maps new function for rush, when terrorist drop bomb then start task (adjustable time)
when task finish then allow rush but if terrorist pick up the bomb ahead of time then not allowed rush (if other
condition not met)
- NEW CVARS: - amx_antirusher_bombdrop 1 // Bomb drop rush functionality on|off
- amx_antirusher_bombdrop_warnings 1 //messages for bombdrop functionality on|off
- amx_antirusher_bombdroptime 30.0 // how much second need for allow rush before is bomb dropped (override when terrorist pick up the bomb min value 15.0 (if less then set 15.0
2.83 - minor bugfix: - bomb pickup not printed when allow rush
- clean code
- new cvar:"Furion" (:D) for log
- public event_roundtime() function changed Event_StartRound()
todo list:
add new cvars to menu:
amx_antirusher_bombdrop 1
amx_antirusher_bombdrop_warnings 1
amx_antirusher_bombdroptime 30.0
amx_antirusher_messages 2
sorry for my english
sign: Furion
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new Float:TEST_TIME=0.1
new Float:WARN_TIME=1.0
new Float:FLASH_TIME=0.8
#define MAX_ZONES 8
new MIN_PLAYERS=2 /*Dobre do testowania w mniej osob
lub gdy chcesz by koniec rashu byl
przy wiekszej liczbbie osob*/
#define TASK_BOMB_RUSH 800743
#define TASK_BOMB_WARNING 700743
#define TASK_ZONE 600743
#define TASK_LOOP 500743
#define TASK_VIEW 400743
#define TASK_INFO 300743
#define TASK_FLASH 200743
#define LANG_PLAYER_C -76 // for print (arbitrary number)
new mUsuwaniestrefy // Menu
new mcbUsuwaniestrefy // Menu Callback
new mZapisacstrefy // Menu
new mcbZapisacstrefy // Menu Callback
new mAntirushControlMenu // Menu
new mcbAntirushControlMenu // Menu Callback
//Uzylem generatora i takie malo eleganckie wyszlo
new map_cors_edit[MAX_ZONES*6]
new zones_edit
new zone_editing=0
new map_editor
new map_cors_file_line=127
new zone_incresment=10
new zone_coords_num=0
new zone_coords[3][13] = { "Koordynat X", "Koordynat Y", "Koordynat Z"}
new editign=0
new edit_g_team[3]
new round_start=0
new lines
new gMsgScreenFade
new rasher[33]=0
new raszer[33]
new flashed[33]=0
new sounded[33]=0
new speed_limit[33]=0
new Float:g_time
new g_team[3]
new g_origin[3]
new map_cors_pre=2
new map_cors_origin[MAX_ZONES*6]
new slap
new warn_control = 0 // miczu
new zones = 0
new zone_color_aktiv[3] = { 0, 0, 255 }
new zone_color_red[3] = { 255, 0, 0 }
new zone_color_yellow[3] = { 255, 255, 0 }
new spr_dot
new ar_messages
new bool:bombIsDown
new Float:bombdroprush
new bool:rush
new SayText
new gmsgSayText
new actions[11][32] = { "barney/donthurtem.wav","nihilanth/nil_now_die.wav","hgrunt/c2a3_hg_laugh.wav","hgrunt/silence!.wav","hgrunt/silence!.wav","barney/whatsgoingon.wav","barney/rightway.wav","barney/nosir.wav","barney/openfire.wav","barney/stophere.wav","hgrunt/c2a2_hg_chat5a.wav"}
public plugin_init()
{
register_plugin("M_AntiRusher","2.83","Miczu")
register_dictionary("M_antirusher.txt")
register_dictionary("common.txt")
register_clcmd("say /rules","info")
register_clcmd("amx_antirush_menu","amx_antirusher_menu",ADMIN_CVAR,"Antirush menu")
register_clcmd("say /antirush_menu","amx_antirusher_menu",ADMIN_CVAR,"Antirush menu")
register_cvar("Furion", "AntirushR 2.83 by [Ballantine's] Furion",FCVAR_SERVER)
register_cvar("xPaw", "AR 2.6",FCVAR_SERVER)
register_cvar("amx_antirusher","1")
register_cvar("amx_antirusher_sound","1")
register_cvar("amx_antirusher_sound_mode","0")
register_cvar("amx_antirusher_warn","1")
register_cvar("amx_antirusher_slap","3")
register_cvar("amx_antirusher_time","105.0")
register_cvar("amx_antirusher_freq","0.1")
register_cvar("amx_antirusher_action","7")
register_cvar("amx_antirusher_cash","50")
register_cvar("amx_antirusher_cash_end","2")
register_cvar("amx_antirusher_immunity","0")
register_cvar("amx_antirusher_rules","1")
register_cvar("amx_antirusher_people","2")
register_cvar("amx_antirusher_bombdrop","1")
register_cvar("amx_antirusher_bombdrop_warnings","1")
register_cvar("amx_antirusher_bombdroptime","30.0")
ar_messages = register_cvar("amx_antirusher_messages","2")
register_event("HLTV","Event_StartRound","a","1=0","2=0")
register_event("RoundTime","event_roundtime","bc")
register_event("SendAudio", "bomb_planted", "a", "2&%!MRAD_BOMBPL")
register_event("DeathMsg","DeathMsg","ade")
register_event("CurWeapon","CurWeapon","be")
// Log events
register_logevent("event_player_action",3,"1=triggered")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
SayText = get_user_msgid("SayText")
gmsgSayText = get_user_msgid("SayText");
gMsgScreenFade = get_user_msgid("ScreenFade")
map_cors_pre = map_cors_present(map_cors_origin,g_team)
TEST_TIME=get_cvar_float("amx_antirusher_freq")
register_menucmd(register_menuid("Antirush Menu"), 1023, "Antirush_menu")
register_menucmd(register_menuid("Punishment Menu"), 1023, "Punishment_menu")
register_menucmd(register_menuid("Antirush Zone Creator"), 1023, "Antirush_Zone_Creator")
register_menucmd(register_menuid("Edit Zone"), 1023, "edit_zone2")
mAntirushControlMenu = menu_create("Antirush Control Menu", "mh_AntirushControlMenu")
mcbAntirushControlMenu = menu_makecallback("mcb_AntirushControlMenu")
menu_additem(mAntirushControlMenu, "Antirush cvar control", "ma_AntirushControlMenu", ADMIN_CVAR, mcbAntirushControlMenu)
menu_additem(mAntirushControlMenu, "Antirush Punishments", "ma_AntirushControlMenu", ADMIN_CVAR, mcbAntirushControlMenu)
menu_additem(mAntirushControlMenu, "Antirush Zone Creator", "ma_AntirushControlMenu", ADMIN_RCON, mcbAntirushControlMenu)
mZapisacstrefy = menu_create("Zapisac strefy", "mh_Zapisacstrefy")
mcbZapisacstrefy = menu_makecallback("mcb_Zapisacstrefy")
menu_additem(mZapisacstrefy, "TAK", "ma_Zapisacstrefy", ADMIN_ALL, mcbZapisacstrefy)
menu_additem(mZapisacstrefy, "NIE", "ma_Zapisacstrefy", ADMIN_ALL, mcbZapisacstrefy)
mUsuwaniestrefy = menu_create("Usuwanie strefy", "mh_Usuwaniestrefy")
mcbUsuwaniestrefy = menu_makecallback("mcb_Usuwaniestrefy")
menu_additem(mUsuwaniestrefy, "TAK", "ma_Usuwaniestrefy", ADMIN_ALL, mcbUsuwaniestrefy)
menu_additem(mUsuwaniestrefy, "NIE", "ma_Usuwaniestrefy", ADMIN_ALL, mcbUsuwaniestrefy)
register_forward(FM_PlayerPreThink, "fwdPlayerPreThink"); // client_PreThink
}
public del_cfg(){
new configdir[128];
get_configsdir(configdir, 127 );
new plugindir[256];
format(plugindir,255,"%s/antirusher",configdir);
new g_ConfigFile[256]
format(g_ConfigFile, 255, "%s/cvars.cfg",plugindir)
if (file_exists(g_ConfigFile)){
delete_file(g_ConfigFile)
}
}
public plugin_precache()
{
spr_dot = precache_model("sprites/dot.spr") // potrzebne do robienia lini
}
public plugin_cfg()
{
new Furion[42]
get_cvar_string("Furion",Furion,41)
new configdir[128];
get_configsdir(configdir, 127 );
new plugindir[256];
format(plugindir,255,"%s/antirusher",configdir);
if (!dir_exists(plugindir)){
if (mkdir(plugindir)==0){ // Create a dir,if it's not exist
log_amx("<<%s>> Config dir <<%s>> successfully created",Furion,plugindir)
return PLUGIN_CONTINUE;
}
else{
log_error(AMX_ERR_NOTFOUND,"<<%s>> Config dir <<%s>> create failed",Furion,plugindir)
//pause("ad");
return PLUGIN_HANDLED;
}
}
new g_ConfigFile[256],line[128]
format(g_ConfigFile, 255, "%s/cvars.cfg",plugindir)
if (!file_exists(g_ConfigFile)){
format(line,127,"amx_antirusher %i // plugin on/off (default on)",get_cvar_num("amx_antirusher"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_sound %i //sounds (for antirush) on/off (default on)",get_cvar_num("amx_antirusher_sound"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_sound_mode %i // 1 - dźwięk raszu słyszy tylko raszujący, 0 - cały serwer | Domyślnie 0 (default 0)",get_cvar_num("amx_antirusher_sound_mode"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_warn %i // 1 - visible red laser 0 - no visible (default 1)",get_cvar_num("amx_antirusher_warn"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_slap %i // Zabiera 10x podaną liczbę HP w ciągu jednej sekundy | Domyślnie 3",get_cvar_num("amx_antirusher_slap"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_time %f // time for Rush after roundstart (sec) (default 105.0 = 1:45)",get_cvar_float("amx_antirusher_time"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_freq %f //check time (seconds) (default 0.1)",get_cvar_float("amx_antirusher_freq"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_rules %i // chat command /rules on/off (default on)",get_cvar_num("amx_antirusher_rules"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_immunity %i //immunity for antirush. need admin flag immunity (default off)",get_cvar_num("amx_antirusher_immunity"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_cash %i // Ilość kasy (w $, mnożone przez 10) zabieranej w ciągu sekundy | Domyślnie 50",get_cvar_num("amx_antirusher_cash"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_cash_end %i",get_cvar_num("amx_antirusher_cash_end"))
write_file(g_ConfigFile, line, -1)
format(line,127,"// 0 - gdy kończy się kasa to biega się bez konsekwencji, liczby od 1-5 to zabiera ci hp zamiast kasy,")
write_file(g_ConfigFile, line, -1)
format(line,127,"//gdy 1 to 1/25 kasy co powinno wziąść, a gdy 5 to zabiera tyle hp co kasy powinno brać. | Domyślnie 2")
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_action %i //default 7.push back",get_cvar_num("amx_antirusher_action"))
write_file(g_ConfigFile, line, -1)
format(line,127,"//0.info on chat,1.slap, 2.kill, 3.kick, 4.Ban, 5.loss speed, 6.Flashed, 7.push back")
write_file(g_ConfigFile, line, -1)
format(line,127,"//8.when it starts to shoot to kill him, 9.prevents effective targeting,10.taking money when its absence is HP ")
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_people %i // minimum number of players to work plugin",get_cvar_num("amx_antirusher_people"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_messages %i // 0 - off, 1 - on(standard color), 2 - colored message, (default 1)",get_cvar_num("amx_antirusher_messages"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_bombdroptime %f //time for allow rush after is bomb dropped (override when T pickup the bomb min value 15.0",get_cvar_float("amx_antirusher_bombdroptime"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_bombdrop_warnings %i//Bomb drop rush messages on|off",get_cvar_float("amx_antirusher_bombdrop_warnings"))
write_file(g_ConfigFile, line, -1)
format(line,127,"amx_antirusher_bombdrop %i // Bomb drop rush functionality on|off",get_cvar_float("amx_antirusher_bombdrop"))
write_file(g_ConfigFile, line, -1)
log_amx("<<%s>> Config file %s successfully created",Furion,g_ConfigFile)
}
else{
server_cmd("exec %s", g_ConfigFile);
log_amx(" <<%s>> loaded", Furion)
}
return PLUGIN_CONTINUE;
}
///////////////////////////////////////////////////////////////////////
///////// M_Antirusher Events /////////
////////////////////////////////////////////////////////////////////////
public client_connect(id){
free_the_man(id) //nie chcemy by ktos kto sie polaczy byl karany
} //kiedy osoba co opuszczajac serwer miala kare
//czyli gdy stary i nowy gracz beda mieli te same id
public client_disconnect(id) {
free_the_man(id) //tak na wszelki wypadek, ale mozna sobie odpuscic
return PLUGIN_CONTINUE
}
public Event_StartRound(){
rush = false
bombIsDown = false
round_start++
MIN_PLAYERS = get_cvar_num("amx_antirusher_people") // zmiana people dziala na starcie rundy
if (round_start<1) return PLUGIN_CONTINUE //takie zabezpieczenie by nie sprawdzalo po czasie rashu
if (map_cors_pre && get_cvar_num("amx_antirusher")) {
slap = floatround(get_cvar_num("amx_antirusher_slap")*(10.0*TEST_TIME)) // slapy biora zawsze tyle samo hp w przedziale czasu
remove_task(TASK_BOMB_RUSH)
remove_task(TASK_BOMB_WARNING)
remove_task(TASK_LOOP)
remove_task(TASK_VIEW)
set_task(TEST_TIME, "checkOrigin",TASK_LOOP,_,_,"b")
set_task(2*WARN_TIME, "rash_warn",TASK_VIEW)
g_time = get_gametime() + get_cvar_float("amx_antirusher_time")
}
return PLUGIN_CONTINUE
}
public player_spawn(id)
{
if(!is_user_alive(id))
return HAM_IGNORED
new arg[1] //Zoptymalizowane uzycie set_task
arg[0]=id //Deklaracja 1 kumurki pamieci zamiast 4 i bez zmian z str-> num i na odwrot
if (map_cors_pre && get_cvar_num("amx_antirusher"))
set_task(6.0,"informclient",TASK_INFO+id,arg,1)
return HAM_IGNORED
}
public bomb_planted() {
rush = true
}
public vip_rush(id){
new name[32]
get_user_name(id,name,31)
client_printc_tag(0,0,1," %L", LANG_PLAYER_C, "AR_VIP_RUSH",name)
rush = true
}
// Player Events
public event_player_action()
{
new szArg[ 64 ], szAction[ 64 ], szName[ 64 ]
new iUserId, id
read_logargv( 0, szArg, 64 )
read_logargv( 2, szAction, 64 )
parse_loguser( szArg, szName, 64, iUserId )
id = find_player( "k", iUserId )
if( id == 0 )
{
return
}
// Hostage touched
if (equal(szAction,"Touched_A_Hostage")) {
rush = true
}
// bomb dropped
if (equal(szAction,"Dropped_The_Bomb")) {
if (get_cvar_num("amx_antirusher_bombdrop") == 1){
bombIsDown = true
bombdroprush = get_cvar_float("amx_antirusher_bombdroptime")
if (bombdroprush < 15.0 ) bombdroprush = 15.0
set_task(bombdroprush , "rash_bombdrop",TASK_BOMB_RUSH)
set_task(5.0 , "warning_bombdrop",TASK_BOMB_WARNING)
}
}
//bomb pickup
if (equal(szAction,"Got_The_Bomb")) {
if (get_cvar_num("amx_antirusher_bombdrop") == 1){
if ( bombIsDown == true && rush == false && get_cvar_num("amx_antirusher_bombdrop_warnings") == 1){
client_printc_tag( 0,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BOMBPICKUP");
}
bombIsDown = false
remove_task(TASK_BOMB_RUSH)
remove_task(TASK_BOMB_WARNING)
}
}
}
//task warning bombdrop
public warning_bombdrop(){
if ( bombIsDown == true && get_cvar_num("amx_antirusher_bombdrop_warnings") == 1){
client_printc_tag( 0,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BOMBDROP");
}
remove_task(TASK_BOMB_WARNING)
set_task(5.0 , "warning_bombdrop",TASK_BOMB_WARNING)
}
//task bombdrop rush
public rash_bombdrop(){
if ( bombIsDown == true){
remove_task(TASK_BOMB_WARNING)
remove_task(TASK_BOMB_RUSH)
rush = true
}
}
/*********************************************BUG????????***************************************************/
public event_roundtime() {
// if (round_start<1) return PLUGIN_CONTINUE //takie zabezpieczenie by nie sprawdzalo po czasie rashu
}
public DeathMsg(){
new vid = read_data(2) //id trupa
free_the_man(vid) //uwalnia trupa by zaczol runde z czystym kontem
}
//////////////////////////////////////////////////////////////////////
///////// M_Antirusher Things /////////
//////////////////////////////////////////////////////////////////////
map_cors_present(maporigin[MAX_ZONES*6],team[3]) {
new zonefile[256],zonefile2[256]
get_localinfo("amxx_configsdir",zonefile, 255);
if(is_linux_server()){
format(zonefile2, 255, "%s/antirusher", zonefile)
if(!(dir_exists(zonefile2))) mkdir (zonefile2)
format(zonefile2, 255, "%s/antirusher/rush.cor", zonefile)
}
else{
format(zonefile2, 255, "%s\antirusher", zonefile)
if(!(dir_exists(zonefile2))) mkdir (zonefile2)
format(zonefile2, 255, "%s\antirusher\rush.cor", zonefile)
}
if (file_exists(zonefile2)){
new readdata[512]
new currentmap[32]
get_mapname(currentmap,31)
new map[32], len
new x11[16],x12[16],y11[16],y12[16],z11[16],z12[16]
new x21[16],x22[16],y21[16],y22[16],z21[16],z22[16]
new x31[16],x32[16],y31[16],y32[16],z31[16],z32[16]
new x41[16],x42[16],y41[16],y42[16],z41[16],z42[16]
new x51[16],x52[16],y51[16],y52[16],z51[16],z52[16]
new x61[16],x62[16],y61[16],y62[16],z61[16],z62[16]
new x71[16],x72[16],y71[16],y72[16],z71[16],z72[16]
new x81[16],x82[16],y81[16],y82[16],z81[16],z82[16]
for(new i=0; i < 128 && read_file(zonefile2,i,readdata,511,len); i++) {
x11="";x12="";y11="";y12="";z11="";z12=""
x21="";x22="";y21="";y22="";z21="";z22=""
x31="";x32="";y31="";y32="";z31="";z32=""
x41="";x42="";y41="";y42="";z41="";z42=""
x51="";x52="";y51="";y52="";z51="";z52=""
x61="";x62="";y61="";y62="";z61="";z62=""
parse(readdata,team,2,map,31,x11,15,x12,15,y11,15,y12,15,z11,15,z12,15,
x21,15,x22,15,y21,15,y22,15,z21,15,z22,15,
x31,15,x32,15,y31,15,y32,15,z31,15,z32,15,
x41,15,x42,15,y41,15,y42,15,z41,15,z42,15,
x51,15,x52,15,y51,15,y52,15,z51,15,z52,15,
x61,15,x62,15,y61,15,y62,15,z61,15,z62,15,
x71,15,x72,15,y71,15,y72,15,z71,15,z72,15,
x81,15,x82,15,y81,15,y82,15,z81,15,z82,15)
lines=i
if(equal(map,currentmap)) {
maporigin[0] = str_to_num(x11)
maporigin[1] = str_to_num(x12)
maporigin[2] = str_to_num(y11)
maporigin[3] = str_to_num(y12)
maporigin[4] = str_to_num(z11)
maporigin[5] = str_to_num(z12)
maporigin[6] = str_to_num(x21)
maporigin[7] = str_to_num(x22)
maporigin[8] = str_to_num(y21)
maporigin[9] = str_to_num(y22)
maporigin[10] = str_to_num(z21)
maporigin[11] = str_to_num(z22)
maporigin[12] = str_to_num(x31)
maporigin[13] = str_to_num(x32)
maporigin[14] = str_to_num(y31)
maporigin[15] = str_to_num(y32)
maporigin[16] = str_to_num(z31)
maporigin[17] = str_to_num(z32)
maporigin[18] = str_to_num(x41)
maporigin[19] = str_to_num(x42)
maporigin[20] = str_to_num(y41)
maporigin[21] = str_to_num(y42)
maporigin[22] = str_to_num(z41)
maporigin[23] = str_to_num(z42)
maporigin[24] = str_to_num(x51)
maporigin[25] = str_to_num(x52)
maporigin[26] = str_to_num(y51)
maporigin[27] = str_to_num(y52)
maporigin[28] = str_to_num(z51)
maporigin[29] = str_to_num(z52)
maporigin[30] = str_to_num(x61)
maporigin[31] = str_to_num(x62)
maporigin[32] = str_to_num(y61)
maporigin[33] = str_to_num(y62)
maporigin[34] = str_to_num(z61)
maporigin[35] = str_to_num(z62)
maporigin[36] = str_to_num(x71)
maporigin[37] = str_to_num(x72)
maporigin[38] = str_to_num(y71)
maporigin[39] = str_to_num(y72)
maporigin[40] = str_to_num(z71)
maporigin[41] = str_to_num(z72)
maporigin[42] = str_to_num(x81)
maporigin[43] = str_to_num(x82)
maporigin[44] = str_to_num(y81)
maporigin[45] = str_to_num(y82)
maporigin[46] = str_to_num(z81)
maporigin[47] = str_to_num(z82)
map_cors_file_line=i
for(new j=0;j<MAX_ZONES;j++){
i=j*6
if(((maporigin[1+i]-maporigin[0+i])>0)&&((maporigin[3+i]-maporigin[2+i])>0)&&((maporigin[5+i]-maporigin[4+i])>0))
zones++
}
return 1
}
if((len<15) && (map_cors_file_line>i)) map_cors_file_line=i
}
log_amx("%L",LANG_SERVER,"AR_NO_ZONE")
if(lines+2<map_cors_file_line) map_cors_file_line=lines+2 //zapobiega zapisywaniu na 127 pozycji gdy nie ma wolnych lini na koncu :)
return 0
}
else log_amx("%L",LANG_SERVER,"AR_NO_FILE")
g_team="XX"
map_cors_file_line=0 //nie ma pluku rush,cor wiec niech zapisze w pierwszej lini
return 0
}
public info(id){
new anti_zasady = get_cvar_num("amx_antirusher_rules")
if(anti_zasady==1){
new map[4]
get_mapname(map,3) // rozpoznawanie typu mapy na podstawie pierwszych 3 liter :p
new rastime = (floatround(get_cvar_float("mp_roundtime") * 60.0)) - (get_cvar_num("amx_antirusher_time"))
new lminute = rastime / 60
new lsec = rastime % 60
if (equal(map,"cs_")){
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_CS_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_CS_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"gg_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_GG_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_GG_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"de_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_DE_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_DE_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"as_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_AS_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_AS_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"fy_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_FY_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_FY_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"aim")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_AIM_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_AIM_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"awp")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_AWP_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_AWP_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"kz_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_KZ_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_KZ_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"fun")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_FUN_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_FUN_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"sur")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_SURF_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_SURF_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"sj_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_SJ_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_SJ_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"ka_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_KA_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_KA_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
else if (equal(map,"he_")){
client_printc_tag(id,0,1," %L", LANG_PLAYER_C, "AR_HE_MAP");//client_print(id,print_chat, "%L",LANG_PLAYER,"AR_HE_MAP")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RUSH_BEFORE_ROUNDEND",lminute,lsec);
}
}
}
public informclient(arg[1]){
// arg[0] to id ^^
if(is_user_connected(arg[0])) { // spradza czy gracz nadal jest na serwie
//time for round start to rush
new bmin = get_cvar_num("amx_antirusher_time") / 60
new bsec = get_cvar_num("amx_antirusher_time") % 60
client_printc_tag(arg[0],0,1," %L", LANG_PLAYER_C, "AR_INFO_WARN");
client_printc_tag(arg[0],0,1," %L", LANG_PLAYER_C, "AR_INFO_CLIENT",bmin,bsec );
}
}
public checkOrigin() { // tu sprawdza czy rashujesz
if (round_start<1) return
if (get_gametime() > g_time)
{
free_the_world()
return
}
if (rush == true)
{
free_the_world()
return
}
new players[32], num,tt_num,ct_num
get_players(players,num)
for(new i=0;i<num;i++)
{
if(is_user_alive(players[i]))
{
if(cs_get_user_team(players[i])==CS_TEAM_T) tt_num++
else if(cs_get_user_team(players[i])==CS_TEAM_CT) ct_num++
}
}
if (tt_num<MIN_PLAYERS)
{
free_the_world()
return
}
if (ct_num<MIN_PLAYERS)
{
free_the_world()
return
}
get_players(players,num)
for(new i = 0; i < num; i++)
{
if(is_user_alive(players[i]))
{
new map[4]
get_mapname(map,3)
if((equal(map,"as_")) && (cs_get_user_vip(players[i])))
{
get_user_origin(players[i],g_origin)
if ((map_cors_origin[0] < g_origin[0] < map_cors_origin[1]) && (map_cors_origin[2] < g_origin[1] < map_cors_origin[3]) && (map_cors_origin[4] < g_origin[2] < map_cors_origin[5]) ||
(map_cors_origin[6] < g_origin[0] < map_cors_origin[7]) && (map_cors_origin[8] < g_origin[1] < map_cors_origin[9]) && (map_cors_origin[10] < g_origin[2] < map_cors_origin[11]) ||
(map_cors_origin[12] < g_origin[0] < map_cors_origin[13]) && (map_cors_origin[14] < g_origin[1] < map_cors_origin[15]) && (map_cors_origin[16] < g_origin[2] < map_cors_origin[17]) ||
(map_cors_origin[18] < g_origin[0] < map_cors_origin[19]) && (map_cors_origin[20] < g_origin[1] < map_cors_origin[21]) && (map_cors_origin[22] < g_origin[2] < map_cors_origin[23]) ||
(map_cors_origin[24] < g_origin[0] < map_cors_origin[25]) && (map_cors_origin[26] < g_origin[1] < map_cors_origin[27]) && (map_cors_origin[28] < g_origin[2] < map_cors_origin[29]) ||
(map_cors_origin[30] < g_origin[0] < map_cors_origin[31]) && (map_cors_origin[32] < g_origin[1] < map_cors_origin[33]) && (map_cors_origin[34] < g_origin[2] < map_cors_origin[35])){
vip_rush(players[i])
}
}
if((equal(g_team,"T")&&(cs_get_user_team(players[i])==CS_TEAM_T))||(equal(g_team,"CT")&&(cs_get_user_team(players[i])==CS_TEAM_CT))||equal(g_team,"XX"))
{
get_user_origin(players[i],g_origin)
if ((map_cors_origin[0] < g_origin[0] < map_cors_origin[1]) && (map_cors_origin[2] < g_origin[1] < map_cors_origin[3]) && (map_cors_origin[4] < g_origin[2] < map_cors_origin[5]) ||
(map_cors_origin[6] < g_origin[0] < map_cors_origin[7]) && (map_cors_origin[8] < g_origin[1] < map_cors_origin[9]) && (map_cors_origin[10] < g_origin[2] < map_cors_origin[11]) ||
(map_cors_origin[12] < g_origin[0] < map_cors_origin[13]) && (map_cors_origin[14] < g_origin[1] < map_cors_origin[15]) && (map_cors_origin[16] < g_origin[2] < map_cors_origin[17]) ||
(map_cors_origin[18] < g_origin[0] < map_cors_origin[19]) && (map_cors_origin[20] < g_origin[1] < map_cors_origin[21]) && (map_cors_origin[22] < g_origin[2] < map_cors_origin[23]) ||
(map_cors_origin[24] < g_origin[0] < map_cors_origin[25]) && (map_cors_origin[26] < g_origin[1] < map_cors_origin[27]) && (map_cors_origin[28] < g_origin[2] < map_cors_origin[29]) ||
(map_cors_origin[30] < g_origin[0] < map_cors_origin[31]) && (map_cors_origin[32] < g_origin[1] < map_cors_origin[33]) && (map_cors_origin[34] < g_origin[2] < map_cors_origin[35])){
punishPlayer(players[i])
raszer[players[i]]=1
}
else{
free_the_man(players[i])
}
}
}
}
}
public rash_warn(){ // tu sprawsza czy ma ci wyswietlic granice rashu
if (get_gametime() > g_time){
return
}
if (get_cvar_num("amx_antirusher_warn")==0) return
new players[32], num, tt_num, ct_num
get_players(players,num)
for(new i=0;i<num;i++)
{
if(is_user_alive(players[i]))
{
if(cs_get_user_team(players[i])==CS_TEAM_T) tt_num++
else if(cs_get_user_team(players[i])==CS_TEAM_CT) ct_num++
}
}
if (equal(g_team,"CT")){
if (tt_num<MIN_PLAYERS) return
if (ct_num<MIN_PLAYERS) return
}
set_task(WARN_TIME, "rash_warn",TASK_VIEW)
new orrigins[3]
for(new j=0;j<num;j++){
if(raszer[players[j]]<1 && is_user_alive(players[j])) // jak juz raszuje to mozna graczowi odpuscic :)
{
if((equal(g_team,"T")&&(cs_get_user_team(players[j])==CS_TEAM_T))||(equal(g_team,"CT")&&(cs_get_user_team(players[j])==CS_TEAM_CT))||equal(g_team,"XX"))
{
get_user_origin(players[j],orrigins)
for(new i=0;i<MAX_ZONES;i++){
if((map_cors_origin[0+i*6]-450 < orrigins[0] < map_cors_origin[0+i*6]) && (map_cors_origin[2+i*6]-100 < orrigins[1] < map_cors_origin[3+i*6]+100) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
zone_warn(players[j],i,0,orrigins)
}
else if((map_cors_origin[1+i*6] < orrigins[0] < map_cors_origin[1+i*6]+450) && (map_cors_origin[2+i*6]-100 < orrigins[1] < map_cors_origin[3+i*6]+100) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
zone_warn(players[j],i,1,orrigins)
}
if((map_cors_origin[0+i*6]-100 < orrigins[0] < map_cors_origin[0+i*6+1]+100) && (map_cors_origin[2+i*6]-450 < orrigins[1] < map_cors_origin[2+i*6]) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
zone_warn(players[j],i,2,orrigins)
}
else if((map_cors_origin[0+i*6]-100 < orrigins[0] < map_cors_origin[0+i*6+1]+100) && (map_cors_origin[3+i*6] < orrigins[1] < map_cors_origin[3+i*6]+450) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
zone_warn(players[j],i,3,orrigins)
}
} // nigdy nie bedziesz widzial przednia i tylna lub lewa i prawa sciane rownoczesnie wiec jest else
}
}
}
}
///////////////////////////////////////////////////////////////////////////
///////// M_Antirusher Punishments /////////
///////////////////////////////////////////////////////////////////////////
punishPlayer(id) {
new action = 1
action = get_cvar_num("amx_antirusher_action")
if ((get_cvar_num("amx_antirusher_immunity") == 1)&&(get_user_flags(id)&ADMIN_IMMUNITY)) {
action = 0
}
switch (action) {
case 0:{
new name[32]
get_user_name(id,name,31)
server_cmd("amx_chat %L",LANG_SERVER,"AR_SRV_INFO", name)
}
case 1: fm_fakedamage ( id, "rashing", slap*1.0,16384)
case 2: user_silentkill(id)
case 3: kickPlayer(id)
case 4: banPlayer(id)
case 5:{
if(speed_limit[id]==0){
speed_limit[id]=1
fm_set_user_maxspeed(id,(fm_get_user_maxspeed(id)/2.0));
}
}
case 6:{
if(flashed[id]==0){
flashed[id]=1
set_task(FLASH_TIME,"Flash",TASK_FLASH+id)
}
}
case 7:{
message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
write_short( 1<<10 ) //15
write_short( 1<<5 )//10
write_short( 1<<12 )//12
write_byte( 255 )
write_byte( 255 )
write_byte( 255 )
write_byte( 255 )
message_end()
new Float: velocity[3]
new Float: DW //Długosc wektora
pev(id,pev_velocity,velocity)
DW=vector_length ( velocity )+0.0001
velocity[0]=(velocity[0]/DW)*(-500.0)
velocity[1]=(velocity[1]/DW)*(-500.0)
if(velocity[2]<0) velocity[2]=velocity[2]*(-1.0)+15.0 //wyrzuca do gory if(velocity[2]<0) velocity[2]=velocity[2]*(-1.0)+150.0 az eredeti
set_pev(id,pev_velocity,velocity)
}
case 8:{
rasher[id]=1
}
case 9:{
aim_on_me(id)
}
case 10:{
ebay_time_to_pay(id) // ogladalem filmik w flashu i to chyba przez to :p
}
default:{
new name[32]
get_user_name(id,name,31)
server_cmd("amx_chat %L:p",LANG_SERVER,"AR_SRV_INFO", name)
}
}
if (warn_control >(25/floatround(10.0*TEST_TIME))){ // jak dlugo siedzisz w granicy to ci pisze w czacie :p
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RASH_WARN");
warn_control=0;}
warn_control+=1
if(get_cvar_num("amx_antirusher_sound")){
if(sounded[id]==0){
new sound_mode = get_cvar_num("amx_antirusher_sound_mode")
if(sound_mode==0) client_cmd(id,"spk %s",actions[action])
else client_cmd(0,"spk %s",actions[action])
sounded[id]=1
}
}
}
kickPlayer(id) {
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RASH_KICK");
server_cmd("amx_kick #%d", id)
}
banPlayer(id) {
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_RASH_BAN");
server_cmd("amx_ban #%d 5 rush", id)
}
public CurWeapon(id){
if(speed_limit[id]==1) fm_set_user_maxspeed(id,(fm_get_user_maxspeed(id)/2.0)); // zmiana broni cie przyspieszy? nie ^^
}
public Flash(id) {
id-=TASK_FLASH
if(flashed[id]){
set_task(FLASH_TIME,"Flash",TASK_FLASH+id)
message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
write_short( 1<<15 )
write_short( 1<<10 )
write_short( 1<<12 )
new x,y,z
x= random_num(0,255)
write_byte( x )
y= random_num(0,255)
write_byte( y )
z= random_num(0,255)
write_byte( z )
write_byte( 255 )
message_end()
}
}
public fwdPlayerPreThink(id){
if (rasher[id]){
new button = pev(id, pev_button)
if ((button & IN_ATTACK2) || (button & IN_ATTACK)){
user_silentkill(id)
}
}
}
public aim_on_me(id){
new radom, radom2
radom = random_num(0,3)
radom2 = random_num(1,6)
new polecenie[64]
switch (radom){
case 0:{
format(polecenie, 63, "+left;")
}
case 1:{
format(polecenie, 63, "+right;")
}
case 2:{
format(polecenie, 63, "+lookup;")
}
case 3:{
format(polecenie, 63, "+lookdown;")
}
}
for (new i=0; i < radom2; i++)
{
add(polecenie, 63, "wait;")
}
switch (radom) {
case 0:{
add(polecenie, 63, "-left;")
}
case 1:{
add(polecenie, 63, "-right;")
}
case 2:{
add(polecenie, 63, "-lookup;")
}
case 3:{
add(polecenie, 63, "-lookdown;")
}
}
client_cmd(id,"%s",polecenie)
}
ebay_time_to_pay(id){
new cash=get_cvar_num("amx_antirusher_cash")*floatround(20.0*TEST_TIME)
new cash2=get_cvar_num("amx_antirusher_cash_end")
new money = cs_get_user_money(id)
if (money-cash > 0)cs_set_user_money(id,money-cash)
else switch(cash2){
case 0: cs_set_user_money(id,0)
case 1:{
fm_fakedamage ( id, "rashing", cash/25.0,16384)
}
case 2:{
fm_fakedamage ( id, "rashing", cash/10.0,16384)
}
case 3:{
fm_fakedamage ( id, "rashing", cash/5.0,16384)
}
case 4:{
fm_fakedamage ( id, "rashing", cash/2.0,16384)
}
case 5:{
fm_fakedamage ( id, "rashing", cash/1.0,16384)
}
}
}
public free_the_man(id){
sounded[id]=0
rasher[id]=0
flashed[id]=0
raszer[id]=0
if(speed_limit[id]==1){
fm_set_user_maxspeed(id,(fm_get_user_maxspeed(id)*2.0))
speed_limit[id]=0
}
}
public free_the_world(){
bombIsDown = false
rush = false
remove_task(TASK_LOOP) //przerywa sprawdzanie rashu
remove_task(TASK_VIEW) //przerywa wyswietlanie granic dla userow
if (get_cvar_num("amx_antirusher_bombdrop") == 1){
remove_task(TASK_BOMB_WARNING)
remove_task(TASK_BOMB_RUSH)
}
if(round_start<1) return
round_start=0
client_printc_tag( 0,0,1," %L", LANG_PLAYER_C, "AR_FREE_WORLD");
}
///////////////////////////////////////////////////////////////////////
///////// M_Antirusher Menu's /////////
///////////////////////////////////////////////////////////////////////
public amx_antirusher_menu(id){
menu_display(id, mAntirushControlMenu, 0)
return PLUGIN_HANDLED
}
public mh_AntirushControlMenu(id, menu, item) {
switch(item)
{
case 0: {
showmenu(id)
}
case 1: {
showmenu2(id)
}
case 2: {
map_editor=id
edit_g_team=g_team
transfer_zones()
zones_edit=zones
if(zones>0) zone_editing=1
show_all_zones()
remove_task(TASK_ZONE)
set_task(0.2, "show_all_zones", TASK_ZONE, _, _, "b")
showmenu3(id)
}
}
}
public ma_AntirushControlMenu(id) {} // bo z generatora amxx studio
public mcb_AntirushControlMenu(id, menu, item) {} // i usuniecie nie daje dobrych efektow...
public transfer_zones(){
for(new i=0;i<MAX_ZONES*6;i++){
map_cors_edit[i]=map_cors_origin[i]
}
}
public showmenu(id)
{
new text[512]
new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)|(1<<10)
new anti_on = get_cvar_num("amx_antirusher") //1
new anti_immu = get_cvar_num("amx_antirusher_immunity") //2
new Float: anti_time = get_cvar_float("amx_antirusher_time") //3
new anti_warn = get_cvar_num("amx_antirusher_warn") //4
new anti_sound = get_cvar_num("amx_antirusher_sound") //5
new anti_sound_mode = get_cvar_num("amx_antirusher_sound_mode") //6
new anti_zasady = get_cvar_num("amx_antirusher_rules") //7
new people = get_cvar_num("amx_antirusher_people") //8
new anti_msg = get_cvar_num("amx_antirusher_messages")
format(text, 511, "\yAntirush Menu - ^n\w1. amx_antirusher %i^n\w2. amx_antirusher_immunity %i^n\w3. amx_antirusher_time %.f^n\w4. amx_antirusher_warn %i^n\w5. amx_antirusher_sound %i^n\w6. amx_antirusher_sound_mode %i^n\w7. amx_antirusher_rules %i^n\w8. amx_antirusher_people %i^n^n\w9. amx_antirusher_messages %i^n^n\w10. %L",anti_on, anti_immu, anti_time, anti_warn, anti_sound, anti_sound_mode,anti_zasady,people,anti_msg,LANG_SERVER,"EXIT")
show_menu(id, keys, text)
return PLUGIN_HANDLED
}
public Antirush_menu(id, key)
{
switch(key)
{
case 0:{
new anti_on = get_cvar_num("amx_antirusher")
if (anti_on==0) set_cvar_num("amx_antirusher",1)
else set_cvar_num("amx_antirusher",0)
}
case 1:{
new anti_immu = get_cvar_num("amx_antirusher_immunity")
if (anti_immu==0) set_cvar_num("amx_antirusher_immunity",1)
else set_cvar_num("amx_antirusher_immunity",0)
}
case 2:{
new Float: anti_time = get_cvar_float("amx_antirusher_time")
if (anti_time < (get_cvar_float("mp_roundtime")*60.0)) anti_time += 5.0
else anti_time= 10.0
set_cvar_float("amx_antirusher_time",anti_time)
}
case 3:{
new anti_warn = get_cvar_num("amx_antirusher_warn")
if (anti_warn==0) set_cvar_num("amx_antirusher_warn",1)
else set_cvar_num("amx_antirusher_warn",0)
}
case 4:{
new anti_sound = get_cvar_num("amx_antirusher_sound")
if (anti_sound==0) set_cvar_num("amx_antirusher_sound",1)
else set_cvar_num("amx_antirusher_sound",0)
}
case 5:{
new anti_sound_mode = get_cvar_num("amx_antirusher_sound_mode")
if (anti_sound_mode==0) set_cvar_num("amx_antirusher_sound_mode",1)
else set_cvar_num("amx_antirusher_sound_mode",0)
}
case 6:{
new anti_zasady = get_cvar_num("amx_antirusher_rules")
if (anti_zasady==0) set_cvar_num("amx_antirusher_rules",1)
else set_cvar_num("amx_antirusher_rules",0)
}
case 7:{
new people = get_cvar_num("amx_antirusher_people")
if (people<16) set_cvar_num("amx_antirusher_people",people+1)
else set_cvar_num("amx_antirusher_people",0)
}
case 8:{
new anti_msg = get_cvar_num("amx_antirusher_messages")
if (anti_msg==0) set_cvar_num("amx_antirusher_messages",1)
else if (anti_msg==1) set_cvar_num("amx_antirusher_messages",2)
else set_cvar_num("amx_antirusher_messages",0)
}
case 9:{
del_cfg()
plugin_cfg()
menu_display(id, mAntirushControlMenu, 0)
return PLUGIN_HANDLED
}
}
showmenu(id)
return PLUGIN_HANDLED
}
public showmenu2(id)
{
new keys
new text[512]
new anti_action = get_cvar_num("amx_antirusher_action")
new anti_cash = get_cvar_num("amx_antirusher_cash")*10
new anti_cash_end = get_cvar_num("amx_antirusher_cash_end")
new Float: anti_freq = get_cvar_float("amx_antirusher_freq")
new anti_slap = get_cvar_num("amx_antirusher_slap")*10
switch(anti_action)
{
case 1:
{
format(text,511,"\yPunishment Menu - ^n\w1. amx_antirusher_action %i^n\w2. amx_antirusher_slap %i^n\w^n\w4. amx_antirusher_freq %.2f ^n\w ",anti_action,anti_slap,anti_freq)
keys = (1<<0)|(1<<1)|(1<<3)|(1<<8)
}
case 10:
{
format(text,511,"\yPunishment Menu - ^n\w1. amx_antirusher_action %i^n\w2. amx_antirusher_cash %i^n\w3. amx_antirusher_cash_end %i^n\w4. amx_antirusher_freq %.2f^n\w ",anti_action, anti_cash, anti_cash_end,anti_freq)
keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<8)
}
default:
{
format(text,511,"\yPunishment Menu - ^n\w1. amx_antirusher_action %i^n\w ^n\w ^n\w4. amx_antirusher_freq %.2f^n\w ",anti_action,anti_freq)
keys = (1<<0)|(1<<3)|(1<<8)
}
}
new text2[512]
switch(anti_action)
{
case 0: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_WARN",LANG_SERVER,"EXIT")
case 1: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_HP",LANG_SERVER,"EXIT")
case 2: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_KILL",LANG_SERVER,"EXIT")
case 3: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_KICK",LANG_SERVER,"EXIT")
case 4: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_BAN",LANG_SERVER,"EXIT")
case 5: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_SLOW",LANG_SERVER,"EXIT")
case 6: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_BLIND",LANG_SERVER,"EXIT")
case 7: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_FFILD",LANG_SERVER,"EXIT")
case 8: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_OFIRE",LANG_SERVER,"EXIT")
case 9: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_BAIM",LANG_SERVER,"EXIT")
case 10:format(text2,511, "^n\w %L ^n\w %L ^n\w9. %L",LANG_SERVER,"AR_ACTION_CASH",LANG_SERVER,"AR_ACTION_CASH2",LANG_SERVER,"EXIT")
default:format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_NEW",LANG_SERVER,"EXIT")
}
add(text,511,text2)
show_menu(id, keys, text)
return PLUGIN_HANDLED
}
public Punishment_menu(id, key)
{
new anti_action = get_cvar_num("amx_antirusher_action")
switch(key)
{
case 0:
{
if(anti_action<10) anti_action +=1
else anti_action=0
set_cvar_num("amx_antirusher_action",anti_action)
}
case 1:
{
if(anti_action==1)
{
new anti_slap = get_cvar_num("amx_antirusher_slap")
if(anti_slap<10) anti_slap +=1
else anti_slap=0
set_cvar_num("amx_antirusher_slap",anti_slap)
}
else if(anti_action==10)
{
new anti_cash = get_cvar_num("amx_antirusher_cash")
if(anti_cash<100) anti_cash +=10
else if(anti_cash<500) anti_cash +=25
else anti_cash=0
set_cvar_num("amx_antirusher_cash",anti_cash)
}
}
case 2:
{
new anti_cash_end = get_cvar_num("amx_antirusher_cash_end")
if(anti_cash_end<5) anti_cash_end +=1
else anti_cash_end=0
set_cvar_num("amx_antirusher_cash_end",anti_cash_end)
}
case 3:
{
new Float: anti_freq = get_cvar_float("amx_antirusher_freq")
if(anti_freq<1.0) anti_freq +=0.100001 // ta jedynka na koncu bo zamiast wyswietalc 0.90000 wyswietlalo 0.89999 wiec dalem zaokraglenie do 0.xx i to na koniec :f
else if (anti_freq<8.0) anti_freq +=0.5
else anti_freq=0.1
set_cvar_float("amx_antirusher_freq",anti_freq)
}
case 8:
{
del_cfg()
plugin_cfg()
menu_display(id, mAntirushControlMenu, 0)
return PLUGIN_HANDLED
}
}
showmenu2(id)
return PLUGIN_HANDLED
}
public showmenu3(id)
{
editign=0
new text[512]
new keys
if(zones_edit==0){
keys = (1<<0)|(1<<4)|(1<<6)|(1<<7)|(1<<8)
format(text, 511, "\yAntirush Zone Creator - ^n^n\w%L: \r%i^n\w1.%L: %s ^n^n ^n^n^n\y5. %L ^n\r7. %L^n\w8. %L ^n\w9. %L",LANG_SERVER,"AR_ZONE_NUM",zones_edit,LANG_SERVER,"AR_ZONE_TEAM",edit_g_team,LANG_SERVER,"AR_ZONE_NEW",LANG_SERVER,"AR_ZONE_DEL",LANG_SERVER,"AR_ZONE_SAVE",LANG_SERVER,"EXIT")
}
else if(zones_edit>0){
keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<7)|(1<<8)
format(text, 511, "\yAntirush Zone Creator - ^n^n\w%L: \r%i^n\w1.%L: %s ^n^n\w2. %L \r%i^n \w3. <- %L 4. -> %L^n^n\y5. %L ^n\r7. %L^n\w8. %L ^n\w9. %L",LANG_SERVER,"AR_ZONE_NUM",zones_edit,LANG_SERVER,"AR_ZONE_TEAM",edit_g_team,LANG_SERVER,"AR_ZONE_EDIT",zone_editing,LANG_SERVER,"BACK",LANG_SERVER,"MORE",LANG_SERVER,"AR_ZONE_NEW",LANG_SERVER,"AR_ZONE_DEL",LANG_SERVER,"AR_ZONE_SAVE",LANG_SERVER,"EXIT")
}
show_menu(id, keys, text)
return PLUGIN_HANDLED
}
public Antirush_Zone_Creator(id, key)
{
if(map_editor!=id){
showmenu(id)
return PLUGIN_HANDLED
}
switch(key)
{
case 0:{
if (equal(edit_g_team,"XX")) edit_g_team="CT"
else if (equal(edit_g_team,"CT")) edit_g_team="T"
else edit_g_team="XX"
}
case 1: {
zone_incresment=10
edit_zone(id)
return PLUGIN_HANDLED
}
case 2:{
if(zone_editing>1) zone_editing--
}
case 3:{
if(zone_editing<zones_edit) zone_editing++
}
case 4:{
if(zones_edit<(MAX_ZONES)){
create_zone(id)
zone_editing=zones_edit
zone_incresment=10
edit_zone(id)
return PLUGIN_HANDLED
}
else{
//client_print(id, print_chat,"%L",LANG_SERVER,"AR_ZONE_MAX")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_ZONE_MAX");
}
}
case 6:{
if(zone_editing>0){
menu_display(id, mUsuwaniestrefy, 0)
return PLUGIN_HANDLED
}
else {
//client_print(id, print_chat,"%L",LANG_SERVER,"AR_ZONE_ZERO")
client_printc_tag( id,0,1," %L", LANG_PLAYER_C, "AR_ZONE_ZERO");
}
}
case 7:{
menu_display(id, mZapisacstrefy, 0)
return PLUGIN_HANDLED
}
case 8:{
amx_antirusher_menu(id)
remove_task(TASK_ZONE)
return PLUGIN_HANDLED
}
}
showmenu3(id)
return PLUGIN_HANDLED
}
public create_zone(id){
new origins[3]
get_user_origin(id,origins,0)
map_cors_edit[0+zones_edit*6]=origins[0]-32
map_cors_edit[1+zones_edit*6]=origins[0]+32
map_cors_edit[2+zones_edit*6]=origins[1]-32
map_cors_edit[3+zones_edit*6]=origins[1]+32
map_cors_edit[4+zones_edit*6]=origins[2]-32
map_cors_edit[5+zones_edit*6]=origins[2]+32
zones_edit++
}
public mh_Zapisacstrefy(id, menu, item) {
if(item==0){
remove_task(TASK_ZONE)
amx_antirusher_menu(id)
map_cors_origin=map_cors_edit
zones=zones_edit
g_team=edit_g_team
if(zones>0) map_cors_pre=1
else map_cors_pre=0
write_to_file()
}
else if(item==1) showmenu3(id)
}
public ma_Zapisacstrefy(id) {}
public mcb_Zapisacstrefy(id, menu, item) {}
public mh_Usuwaniestrefy(id, menu, item) {
if(item==0){
amx_antirusher_menu(id)
delete_zone(zone_editing)
if((zone_editing-1)>=(zones_edit-1)) zone_editing = zones_edit-1
zones_edit--
showmenu3(id)
}
else if(item==1) showmenu3(id)
}
public ma_Usuwaniestrefy(id) {}
public mcb_Usuwaniestrefy(id, menu, item) {}
public delete_zone(zone_num){
new x_num=zone_num-1
while(x_num<(MAX_ZONES-1)){
map_cors_edit[0+x_num*6]=map_cors_edit[6+x_num*6]
map_cors_edit[1+x_num*6]=map_cors_edit[7+x_num*6]
map_cors_edit[2+x_num*6]=map_cors_edit[8+x_num*6]
map_cors_edit[3+x_num*6]=map_cors_edit[9+x_num*6]
map_cors_edit[4+x_num*6]=map_cors_edit[10+x_num*6]
map_cors_edit[5+x_num*6]=map_cors_edit[11+x_num*6]
x_num++
}
}
public edit_zone(id){
editign=1
new text[512]
new keys= (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<8)
format(text, 511, "\yEdit Zone - ^n^n\w1. %L: %s ^n\r 2.<- %L 3.-> %L^n\y 4.<- %L 5.-> %L^n ^n\w7. %L: %i ^n\w9. %L",LANG_SERVER,"AR_EDIT_COOR",zone_coords[zone_coords_num],LANG_SERVER,"BACK",LANG_SERVER,"MORE",LANG_SERVER,"BACK",LANG_SERVER,"MORE",LANG_SERVER,"AR_EDIT_CHANG",zone_incresment,LANG_SERVER,"EXIT")
show_menu(id, keys, text)
return PLUGIN_HANDLED
}
public edit_zone2(id, key){
switch(key){
case 0:{
if(zone_coords_num<2)zone_coords_num++
else zone_coords_num=0
}
case 1:{
if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]+zone_incresment)<(map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]-32)) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]+=zone_incresment
}
case 2:{
if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]-zone_incresment)>-8191) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]-=zone_incresment
}
case 3:{
if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]-zone_incresment)>(map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]+32)) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]-=zone_incresment
}
case 4:{
if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]+zone_incresment)<8191) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]+=zone_incresment
}
case 6:{
if(zone_incresment<1000)zone_incresment*=10
else zone_incresment=1
}
case 8:{
showmenu3(id)
return PLUGIN_HANDLED
}
}
edit_zone(id)
return PLUGIN_HANDLED
}
//////////////////////////////////////////////////////////////////////////
///////// M_Antirusher Draw Lines /////////
//////////////////////////////////////////////////////////////////////////
public FX_Line(start[3], stop[3], color[3], brightness, id) {
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
write_byte( TE_BEAMPOINTS )
write_coord(start[0])
write_coord(start[1])
write_coord(start[2])
write_coord(stop[0])
write_coord(stop[1])
write_coord(stop[2])
write_short( spr_dot )
write_byte( 1 ) // framestart
write_byte( 1 ) // framerate
write_byte( 4 ) // life in 0.1's
write_byte( 5 ) // width
write_byte( 0 ) // noise
write_byte( color[0] ) // r, g, b
write_byte( color[1] ) // r, g, b
write_byte( color[2] ) // r, g, b
write_byte( brightness ) // brightness
write_byte( 0 ) // speed
message_end()
}
public DrawLine(x1, y1, z1, x2, y2, z2, color[3],id) {
new start[3]
new stop[3]
start[0] = ( x1 )
start[1] = ( y1 )
start[2] = ( z1 )
stop[0] = ( x2 )
stop[1] = ( y2 )
stop[2] = ( z2 )
FX_Line(start, stop, color, 200, id)
}
public ar_zone(zone_num,id){
new start[3],stop[3]
new xyz=0
if(zone_editing==zone_num) xyz=1
zone_num=(zone_num-1)*6
start[0]= map_cors_edit[0+zone_num]
start[1]= map_cors_edit[2+zone_num]
start[2]= map_cors_edit[4+zone_num]
stop[0]= map_cors_edit[1+zone_num]
stop[1]= map_cors_edit[3+zone_num]
stop[2]= map_cors_edit[5+zone_num]
ShowZoneBox(start, stop, id,xyz)
}
public ShowZoneBox(mins[3], maxs[3], id,xyz) {
DrawLine(maxs[0], maxs[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_aktiv, id)
DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], maxs[2], zone_color_aktiv, id)
DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], maxs[1], mins[2], zone_color_aktiv, id)
DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], mins[2], zone_color_aktiv, id)
DrawLine(mins[0], mins[1], mins[2], mins[0], maxs[1], mins[2], zone_color_aktiv, id)
DrawLine(mins[0], mins[1], mins[2], mins[0], mins[1], maxs[2], zone_color_aktiv, id)
DrawLine(mins[0], maxs[1], maxs[2], mins[0], maxs[1], mins[2], zone_color_aktiv, id)
DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], mins[2], zone_color_aktiv, id)
DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], mins[2], zone_color_aktiv, id)
DrawLine(maxs[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_aktiv, id)
DrawLine(maxs[0], mins[1], maxs[2], mins[0], mins[1], maxs[2], zone_color_aktiv, id)
DrawLine(mins[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_aktiv, id)
if((xyz==1)&&(editign==1)){
if(zone_coords_num==0){
DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], mins[2], zone_color_yellow, id)
DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_yellow, id)
DrawLine(mins[0], maxs[1], maxs[2], mins[0], mins[1], mins[2], zone_color_red, id)
DrawLine(mins[0], maxs[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red, id)
}
else if( zone_coords_num==1){
DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_red, id)
DrawLine(maxs[0], mins[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red, id)
DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], maxs[2], zone_color_yellow, id)
DrawLine(maxs[0], maxs[1], mins[2], mins[0], maxs[1], maxs[2], zone_color_yellow, id)
}
else{
DrawLine(maxs[0], maxs[1], maxs[2], mins[0], mins[1], maxs[2], zone_color_yellow, id)
DrawLine(maxs[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_yellow, id)
DrawLine(maxs[0], maxs[1], mins[2], mins[0], mins[1], mins[2], zone_color_red, id)
DrawLine(maxs[0], mins[1], mins[2], mins[0], maxs[1], mins[2], zone_color_red, id)
}
}
}
public show_all_zones(){
new num=1
while(num<=zones_edit){
ar_zone(num,map_editor)
num++
}
if(zone_editing>0){
new origins[3], origins2[3]
get_user_origin(map_editor,origins)
new Float: range_line
new Float: range_origins[6]
for(new i=0;i<6;i++) range_origins[i] = (map_cors_edit[i+6*(zone_editing-1)])*1.0
range_line= floatsqroot(((range_origins[1]-range_origins[0])/2.0-origins[0])*((range_origins[1]-range_origins[0])/2.0-origins[0])+((range_origins[3]-range_origins[2])/2.0-origins[1])*((range_origins[3]-range_origins[2])/2.0-origins[1])+((range_origins[5]-range_origins[4])/2.0-origins[2])*((range_origins[5]-range_origins[4])/2.0-origins[2]))
if(range_line>20000) for(new i=0;i<3;i++){
origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)/6
}
else if(range_line>15000) for(new i=0;i<3;i++){
origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)/5
}
else if(range_line>10000) for(new i=0;i<3;i++){
origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)/3
}
else for(new i=0;i<3;i++){
origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)
}
FX_Line(origins, origins2, zone_color_red,200,map_editor)
}
}
public zone_warn(id,zone,direction,origins[3]){
new start[3],stop[3]
start[2]=origins[2]-110
stop[2]=origins[2]-110
switch(direction){
case 0:{
start[0]=map_cors_origin[zone*6]+5
stop[0]=map_cors_origin[zone*6]+5
start[1]=map_cors_origin[zone*6+2]
stop[1]=map_cors_origin[zone*6+3]
}
case 1:{
start[0]=map_cors_origin[zone*6+1]-5
stop[0]=map_cors_origin[zone*6+1]-5
start[1]=map_cors_origin[zone*6+2]
stop[1]=map_cors_origin[zone*6+3]
}
case 2:{
start[0]=map_cors_origin[zone*6+0]
stop[0]=map_cors_origin[zone*6+1]
start[1]=map_cors_origin[zone*6+2]+5
stop[1]=map_cors_origin[zone*6+2]+5
}
case 3:{
start[0]=map_cors_origin[zone*6+0]
stop[0]=map_cors_origin[zone*6+1]
start[1]=map_cors_origin[zone*6+3]-5
stop[1]=map_cors_origin[zone*6+3]-5
}
}
for(new i=0;i<9;i++){
start[2]+=30
stop[2]+=30
FX_Line(start, stop, zone_color_red, 60, id)
}
}
///////////////////////////////////////////////////////////////////////////
///////// M_Antirusher Save to file /////////
///////////////////////////////////////////////////////////////////////////
public write_to_file(){
new text[512],text2[64]
new currentmap[32]
get_mapname(currentmap,31)
format(text,511,"%s %s ", g_team, currentmap)
new x0[6],x1[6],y0[6],y1[6],z0[6],z1[6]
for(new i=0;i<zones;i++){
num_to_str(map_cors_origin[0+i*6],x0,5)
num_to_str(map_cors_origin[1+i*6],x1,5)
num_to_str(map_cors_origin[2+i*6],y0,5)
num_to_str(map_cors_origin[3+i*6],y1,5)
num_to_str(map_cors_origin[4+i*6],z0,5)
num_to_str(map_cors_origin[5+i*6],z1,5)
format(text2,63,"%s %s %s %s %s %s ",x0,x1,y0,y1,z0,z1)
add(text,511,text2)
}
if(is_linux_server()){
new zonefile[256]
get_localinfo("amxx_configsdir",zonefile, 255);
format(zonefile, 255, "%s/antirusher/rush.cor", zonefile)
if((write_file ( zonefile, text, map_cors_file_line ))==0) log_amx("<<Error when overwriting rush.cor>>")
}
else{
if((write_file ( "addons\amxmodx\configs\antirusher\rush.cor", text, map_cors_file_line ))==0) log_amx("<<Error when overwriting rush.cor>>")
}
}
// Stocks, ported by xPaw
stock fm_create_entity(const classname[])
return engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname))
stock fm_fake_touch(toucher, touched)
return dllfunc(DLLFunc_Touch, toucher, touched)
stock fm_remove_entity(index)
return engfunc(EngFunc_RemoveEntity, index)
stock fm_DispatchSpawn(entity)
return dllfunc(DLLFunc_Spawn, entity)
stock fm_set_kvd(entity, const key[], const value[], const classname[] = "") {
if (classname[0])
set_kvd(0, KV_ClassName, classname)
else {
new class[32]
pev(entity, pev_classname, class, sizeof class - 1)
set_kvd(0, KV_ClassName, class)
}
set_kvd(0, KV_KeyName, key)
set_kvd(0, KV_Value, value)
set_kvd(0, KV_fHandled, 0)
return dllfunc(DLLFunc_KeyValue, entity, 0)
}
stock fm_fakedamage(victim, const classname[], Float:takedmgdamage, damagetype) {
new class[] = "trigger_hurt"
new entity = fm_create_entity(class)
if (!entity)
return 0
new value[16]
float_to_str(takedmgdamage * 2, value, sizeof value - 1)
fm_set_kvd(entity, "dmg", value, class)
num_to_str(damagetype, value, sizeof value - 1)
fm_set_kvd(entity, "damagetype", value, class)
fm_set_kvd(entity, "origin", "8192 8192 8192", class)
fm_DispatchSpawn(entity)
set_pev(entity, pev_classname, classname)
fm_fake_touch(entity, victim)
fm_remove_entity(entity)
return 1
}
stock fm_set_user_maxspeed(index, Float:speed = -1.0) {
engfunc(EngFunc_SetClientMaxspeed, index, speed)
set_pev(index, pev_maxspeed, speed)
return 1
}
stock Float:fm_get_user_maxspeed(index) {
new Float:speed
pev(index, pev_maxspeed, speed)
return speed
}
stock client_printc_tag(id,custom,tag,msg[],any:...)
{
new messages = get_pcvar_num(ar_messages);
if(!messages) return 0;
new changeCount, num, i, j, argnum = numargs(), player;
static newMsg[191], message[191], changed[8], players[32];
if(id)
{
players[0] = id;
num = 1;
}
else get_players(players,num);
for(i=0;i<num;i++)
{
player = players[i];
changeCount = 0;
if(!is_user_connected(player)) continue;
// we have to change LANG_PLAYER into
// a player-specific argument, because
// ML doesn't work well with SayText
for(j=4;j<argnum;j++)
{
if(getarg(j) == LANG_PLAYER_C)
{
setarg(j,0,player);
changed[changeCount++] = j;
}
}
// do user formatting
vformat(newMsg,190,msg,5);
// and now we have to change what we changed
// back into LANG_PLAYER, so that the next
// player will be able to have it in his language
for(j=0;j<changeCount;j++)
{
setarg(changed[j],0,LANG_PLAYER_C);
}
if(tag)
{
formatex(message,190,"%L %s",player,"ANTIRUSH",newMsg);
}
else formatex(message,190,"%s",newMsg);
// optimized color swapping
if(messages == 2)
{
replace_all(message,190,"!t","^x03"); // %n = team color
replace_all(message,190,"!g","^x04"); // %g = green
replace_all(message,190,"!y","^x01"); // %e = regular
}
else
{
replace_all(message,190,"!t","");
replace_all(message,190,"!g","");
replace_all(message,190,"!y","");
}
// now do our formatting (I used two variables because sharing one caused glitches)
/* if(tag)
{
formatex(message,190,"^x01[%L] %s",player,"ANTIRUSH",newMsg);
}
else formatex(message,190,"^x01%s",newMsg);*/
message_begin(MSG_ONE,gmsgSayText,_,player);
write_byte((custom > 0) ? custom : player);
write_string(message);
message_end();
}
return 1;
}
stock client_printc(const id, const string[], {Float, Sql, Resul,_}:...) {
new msg[191], players[32], count = 1
vformat(msg, sizeof msg - 1, string, 3)
replace_all(msg,190,"!g","^4")
replace_all(msg,190,"!y","^1")
replace_all(msg,190,"!t","^3")
if(id)
players[0] = id
else
get_players(players,count,"ch")
for (new i = 0 ; i < count ; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, SayText,_, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
Feliratkozás:
Bejegyzések (Atom)
[ZP] Antidote
/***************************************************************************\ ===================================== ...
-
Antirusher Plugin xPaw féle átdolgozva eddigi teszt: nincs hiba /* 2.81 - New print functions: - ML Print ...
-
kis segítség: Bevezetőül: Változót deklarálhatunk az alábbi kulcsszavak egyikével: new, stock, public, static Mindegyik változót hoz létre, ...
-
/***************************************************************************\ ===================================== ...