Hát a Deagle tele tárral... Itt a topicban volt róla szó...
viewtopic.php?f=9&t=1736&p=3104&hilit=deagle&sid=3480ddea2f817bff4adb0cdb3d3dfd22#p3104Itt a kezdővédelem sma fálja... remélem azért a cvarokat ki tudod nézni belőle...
Kód:
/*
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ANTI-SPAWNKILL GOD by Grinf4ce | Version 1.0.0
-------------------------------------------------------------
This Plugin stops Spawnattacks and Spawnkills. If a player
get hited in a certain delay, he gets no damage (Mode 1) or
he have more than 100 HP (certain trough CVAR) and died
slowier (Mode 2). You can set specified protectimes in
configs/skg_map.cfg. In format: <mapname> <seconds>.
-------------------------------------------------------------
Credits:
Connorr [ Thanks for the note about the fullupdate issue ]
Atomen [ Thanks for the Fakemeta Glowfunction :) ]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "Anti-Spawnkill God"
#define VERSION "1.0"
#define AUTHOR "Grinf4ce"
#define TASK_ID 33211
new bool:g_pnss[33],bool:IsProtect[33];
new g_ccp;
new SKG_MODE, SKG_PROHP, SKG_PROAP, SKG_NORHP, SKG_NORAP, SKG_GLOW, SKG_GLOW_R, SKG_GLOW_G, SKG_GLOW_B, SKG_NOTE, SKG_BAR, SKG_DELAY
new Float:Protecttime
new filename[256];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("skg_version",VERSION,FCVAR_SERVER);
set_cvar_string("skg_version",VERSION);
register_event("ResetHUD", "Reset_HUD", "b")
register_clcmd("fullupdate", "CmdFullUpdate")
register_event("StatusValue", "show_warning", "be", "1=2")
get_configsdir(filename,255)
format(filename,255,"%s/skg_map.cfg",filename)
/* Register Cvar's */
SKG_MODE = register_cvar("skg_mode","1") /* Spawnkill-God Protect Mode - 1: Godmode ; 2 NoGod but more Protect-Health */
SKG_PROHP = register_cvar("skg_protecthp","100") /* Protect-HP if skg_mode is 2 */
SKG_PROAP = register_cvar("skg_protectap","100") /* Protect-AP if skg_mode is 2 */
SKG_NORHP = register_cvar("skg_normalhp","100") /* Start-HP if skg_mode is 2 */
SKG_NORAP = register_cvar("skg_normalap","100") /* Start-AP if skg_mode is 2 */
SKG_GLOW = register_cvar("skg_glow","1") /* Glow on Spawn for Delay-Time */
SKG_GLOW_R = register_cvar("skg_glow_r","000") /* Glowcolor in RGB: Red */
SKG_GLOW_G = register_cvar("skg_glow_g","255") /* Glowcolor in RGB: Green */
SKG_GLOW_B = register_cvar("skg_glow_b","000") /* Glowcolor in RGB: Blue */
SKG_NOTE = register_cvar("skg_warning","1") /* If you aimed on a protected Player you will get a warning */
SKG_BAR = register_cvar("skg_timebar","1") /* Shows yourself how long your protection left */
SKG_DELAY = register_cvar("skg_delay","5.0") /* Spawnkill-God Protect-Delay in Seconds */
get_protectime_by_map() /* Get Protectime by Map */
}
public Reset_HUD(id)
{
if (!is_user_alive(id))
return;
if (g_pnss[id])
{
g_pnss[id] = false;
return;
}
PlayerSpawn(id);
}
public CmdFullUpdate(id)
{
g_pnss[id] = true;
static const szFwFmClientCommandPost[] = "Client_Cmd_Post";
g_ccp = register_forward(FM_ClientCommand, szFwFmClientCommandPost, 1);
return 0;
}
public Client_Cmd_Post(id)
{
unregister_forward(FM_ClientCommand, g_ccp, 1);
g_pnss[id] = false;
return FMRES_HANDLED;
}
/* Send Console-Message */
public client_connect(id)
{
client_cmd(id, "echo ");
client_cmd(id, "echo ^" ***********************************************^" ");
client_cmd(id, "echo ^" * This server is using Anti-Spawnkill God by Grinf4ce^" ");
client_cmd(id, "echo ^" * ++ DONT SPAWNATTACK OR SPAWNKILL! ++^" ");
client_cmd(id, "echo ^" *^"");
client_cmd(id, "echo ^" * Spawnkill-Protecttime is: %0.1f second(s)^" ",Protecttime);
client_cmd(id, "echo ^" ***********************************************^" ");
client_cmd(id, "echo ");
IsProtect[id] = false
}
public client_disconnect(id) {
IsProtect[id] = false
}
/* ProtectBarfunction */
public ProtectBar(id, seconds)
{
message_begin(MSG_ONE, get_user_msgid("BarTime"), {0,0,0}, id);
write_byte(seconds);
write_byte(0);
message_end();
}
/* Spawnfunction */
public PlayerSpawn(id) {
if(Protecttime != 0.0)
{
if(get_pcvar_num(SKG_MODE) == 1)
{
/* MODE: Godmode */
set_pev(id,pev_takedamage,0)
}
else
{
/* MODE: Protect Health */
set_pev(id,pev_health,get_pcvar_num(SKG_PROHP))
set_pev(id,pev_armorvalue,get_pcvar_num(SKG_PROAP))
}
/* Let User glow if enabled */
if(get_pcvar_num(SKG_GLOW) == 1)
{
set_rendering(id, kRenderFxGlowShell, get_pcvar_num(SKG_GLOW_R), get_pcvar_num(SKG_GLOW_G), get_pcvar_num(SKG_GLOW_B), kRenderNormal, 25);
}
/* Global Informationvar */
IsProtect[id] = true
/* Show timebar if enabled */
if(get_pcvar_num(SKG_BAR) == 1)
{
ProtectBar(id,floatround(Protecttime))
}
/* Set Task */
set_task(Protecttime,"Remove_all_effects",id + TASK_ID)
}
return PLUGIN_HANDLED
}
/* Removefunction */
public Remove_all_effects(get_id) {
new id = get_id - TASK_ID;
if(get_pcvar_num(SKG_MODE) == 1)
{
set_pev(id,pev_takedamage,1) /* Remove Player Godmode */
}
else
{
set_pev(id,pev_health,get_pcvar_num(SKG_NORHP)) /* Set User's Normalhp */
set_pev(id,pev_armorvalue,get_pcvar_num(SKG_NORAP)) /* Set User's Normalap */
}
if(get_pcvar_num(SKG_GLOW) == 1)
set_rendering(id) /* Remove Glowing if enabled */
IsProtect[id] = false
}
/* Warningfunction */
public show_warning(id)
{
if(get_pcvar_num(SKG_NOTE) == 0)
return PLUGIN_HANDLED /* CVAR skg_warning is 0 */
new target = read_data(2) /* Get target of aimer */
if (!target) { return PLUGIN_HANDLED; } /* Do nothing, if target is empty */
new aimed[32]
get_user_name(target, aimed, 31) /* Get name of aimed */
if(IsProtect[target] == true)
{
set_hudmessage(255, 0, 0, -1.0, 0.6, 0, 6.0, 3.0)
show_hudmessage(id, "'%s' is in spawn-protection! ^n ** Dont spawnattack or spawnkill! **",aimed)
}
return PLUGIN_HANDLED
}
/* Glowfunction */
set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
new Float:RenderColor[3];
RenderColor[0] = float(r);
RenderColor[1] = float(g);
RenderColor[2] = float(b);
set_pev(entity, pev_renderfx, fx);
set_pev(entity, pev_rendercolor, RenderColor);
set_pev(entity, pev_rendermode, render);
set_pev(entity, pev_renderamt, float(amount));
return FMRES_IGNORED;
}
/* Get Mapprotectime */
public get_protectime_by_map() {
new readdata[128],txtlen
new parsedmap[100], parsedtime[3]
new map[100]
new bool:Status
new fsize = file_size(filename,1)
get_mapname(map,99)
Status = false
for (new line=0;line<=fsize;line++)
{
read_file(filename,line,readdata,127,txtlen)
parse(readdata,parsedmap,99,parsedtime,2)
new Float:ptime = str_to_float(parsedtime);
if(equal(map,parsedmap))
{
Protecttime = ptime
Status = true
server_print("[SKG] Map found in skg_map.cfg: Protect-Time: %0.1f second(s).",Protecttime)
break;
}
}
if(Status == false)
{
Protecttime = get_pcvar_float(SKG_DELAY)
server_print("[SKG] Map NOT found skg_map.cfg: Protect-Time: %0.1f second(s) [default].",Protecttime)
}
return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3079\\ f0\\ fs16 \n\\ par }
*/