热身回合 附源码 完全自定义
没什么好说的http://p2.tuzhan.com:8080/2012/upn2/2012-05-16/18/abc783413127ok.tuzhan.com_d32c79d406d94ae5bd69c6f8b6b77f99_m.bmp 挖.. 完全自定义,站位置 看看是什么样的! 想问下楼主怎么把这个插件添加到gomatch菜单里面 不会 没试过 我是个 新手 没有源码 ,需要源码 的同学 要注意了。 。。。!!!! 忘了 里面 源码了 唉 补偿#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#define PLUGIN "WarmUP Pro"
#define VERSION "3.1"
#define AUTHOR "ReymonARG"
#define time_delay 1
#define ITEM_HE (1<<0) // "a"
#define ITEM_FS (1<<1) // "b"
#define ITEM_SG (1<<2) // "c"
#define ITEM_C4 (1<<3) // "d"
#define HIDE_MONEY (1<<5) // Disable Hud off Money
#define SHOW_MONEY (1<<7) // Enable Hud off Money
new num_time, sync, time_s, activadoo, respawn3d, itemsxd, RGB, cvar_x, cvar_y, mode, timeprotect
new bool:g_is_dead;
new bool:g_can_respawn;
new bool:g_cuchi;
new bool:g_items;
new bool:wup_on;
new bool:g_is_connect;
new g_iMsg_HideWeapon
#define FLAG_ALIVE (1<<0)
#define FLAG_DEAD (1<<1)
#define FLAG_DISCONNECT (1<<2)
#define FLAG_T (1<<0)
#define FLAG_CT (1<<1)
// custom indexes
#define DEFUSER 0
#define SHIELD 2
#define CONTAIN_FLAG_OF_INDEX(%1,%2) ((%1) & (1<<(%2)))
new const g_wbox_class[] = "weaponbox"
new const g_shield_class[] = "weapon_shield"
new const g_wbox_model[] = "models/w_weaponbox.mdl"
new const g_model_prefix[] = "models/w_"
new g_max_clients
new g_max_entities
new g_pcvar_allow
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
stock fm_strip_user_weapons(index) {
new ent = fm_create_entity("player_weaponstrip")
if (!pev_valid(ent))
return 0
dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, index)
engfunc(EngFunc_RemoveEntity, ent)
return 1
}
stock fm_give_item(index, const item[]) {
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
return 0
new ent = fm_create_entity(item)
if (!pev_valid(ent))
return 0
new Float:origin
pev(index, pev_origin, origin)
set_pev(ent, pev_origin, origin)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)
new save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, index)
if (pev(ent, pev_solid) != save)
return ent
engfunc(EngFunc_RemoveEntity, ent)
return -1
}
new const g_weapon_names[][] =
{
"", // Null random 1 to XThis is 0
"weapon_p228",
"weapon_scout",
"weapon_xm1014",
"weapon_mac10",
"weapon_aug",
"weapon_elite",
"weapon_fiveseven",
"weapon_ump45",
"weapon_sg550",
"weapon_galil",
"weapon_famas",
"weapon_usp",
"weapon_glock18",
"weapon_awp",
"weapon_mp5navy",
"weapon_m249",
"weapon_m3",
"weapon_m4a1",
"weapon_tmp",
"weapon_g3sg1",
"weapon_deagle",
"weapon_sg552",
"weapon_ak47",
"weapon_p90"
};
#define MAX_WEAPONS sizeof(g_weapon_names)
new const g_weapon_ammo[] =
{
"", // Null random 1 to XThis is 0
"ammo_357sig",
"ammo_762nato",
"ammo_buckshot",
"ammo_45acp",
"ammo_556nato",
"ammo_9mm",
"ammo_57mm",
"ammo_45acp",
"ammo_556nato",
"ammo_556nato",
"ammo_556nato",
"ammo_45acp",
"ammo_9mm",
"ammo_338magnum",
"ammo_9mm",
"ammo_556natobox",
"ammo_buckshot",
"ammo_556nato",
"ammo_9mm",
"ammo_762nato",
"ammo_50ae",
"ammo_556nato",
"ammo_762nato",
"ammo_57mm"
};
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("wup_version", VERSION,FCVAR_SERVER)
register_cvar("wup_author", AUTHOR,FCVAR_SERVER)
register_event("TextMsg","autostartrr","a","2&#Game_C");
RegisterHam(Ham_Killed, "player", "FwdPlayerDeath", 1);
RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
register_event("CurWeapon", "check_change", "be", "1=1");
register_forward(FM_SetModel, "forward_set_model")
g_pcvar_allow = register_cvar("wup_drop", "")
g_max_clients = global_get(glb_maxClients)
g_max_entities = global_get(glb_maxEntities)
sync = CreateHudSyncObj();
register_dictionary( "warmuppro.txt" );
register_concmd("wup_disable","admin_exec1",ADMIN_BAN,"Stop the WarmUP")
register_concmd("wup_enable","admin_exec2",ADMIN_BAN,"Start a new WarmUP")
g_iMsg_HideWeapon = get_user_msgid( "HideWeapon" );
activadoo = register_cvar("wup_autostart", "1")
respawn3d = register_cvar("wup_respawn", "1")
itemsxd = register_cvar("wup_items", "abcd")
mode = register_cvar("wup_mode", "1")
num_time = register_cvar("wup_time","120")
RGB = register_cvar("wup_color", "255255255")
cvar_x = register_cvar("wup_setx", "-1.0")
cvar_y = register_cvar("wup_sety", "0.28")
timeprotect = register_cvar("wup_protecttime", "3")
set_task(0.1, "escribircvars")
}
public escribircvars()
{
new filename
get_configsdir(filename, 63);
add(filename, 63, "/warmuppro.cfg");
if(file_exists(filename))
server_cmd("exec ^"%s^"",filename)
else
{
write_file(filename,";/////////WARMUP PRO FILE\\\\\\\\\\;")
write_file(filename,";/////////WARMUP PRO FILE\\\\\\\\\\;")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Enable the WarmUP when the GameStart")
write_file(filename,"wup_autostart 1")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Enable the respawn is a player die in the WarmUP")
write_file(filename,"wup_respawn 1")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Items to give to a player in the respawn")
write_file(filename,";A) Give HE B) Give FB C) Give SG")
write_file(filename,";D) Give C4 to Terrorist And Defuse to CT.")
write_file(filename,"wup_items ^"abcd^"")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";0) Normal Rounds1) Weapon Chance2) Knife")
write_file(filename,"wup_mode 1")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Set the during of the warmUP.")
write_file(filename,"wup_time 120")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Color of the Hud that show time remending.")
write_file(filename,"wup_color ^"255255255^"")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";X Position of the hud")
write_file(filename,"wup_setx ^"-1.0^"")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Y Position of the hud")
write_file(filename,"wup_sety ^"0.28^"")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";Set Time of SpawnProtection0 = Disable")
write_file(filename,"wup_protectime 3")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";This plis dont change :D ")
write_file(filename,"wup_drop ^"^" // This Dont change")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";")
write_file(filename,";/////////WARMUP PRO FILE\\\\\\\\\\;")
write_file(filename,";/////////WARMUP PRO FILE\\\\\\\\\\;")
write_file(filename,"echo WarmUP Pro Cvars Enable.")
write_file(filename,"echo WarmUP Pro Create by ReymonARG")
write_file(filename,";/////////WARMUP PRO FILE\\\\\\\\\\;")
write_file(filename,";/////////WARMUP PRO FILE\\\\\\\\\\;")
server_cmd("exec %s",filename)
}
}
public get_item_flags()
{
new sFlags
get_pcvar_string(itemsxd,sFlags,23)
return read_flags(sFlags)
}
接着 复制下面的
public forward_set_model(ent, const model[])
{
if( wup_on && get_pcvar_num(mode) == 1 || wup_on && get_pcvar_num(mode) == 2)
{
if (!pev_valid(ent) || !equali(model, g_model_prefix, sizeof g_model_prefix - 1) || equali(model, g_wbox_model))
return FMRES_IGNORED
new id = pev(ent, pev_owner)
if (!(1 <= id <= g_max_clients))
return FMRES_IGNORED
new weapon
static class
pev(ent, pev_classname, class, sizeof class - 1)
if (equal(class, g_shield_class))
weapon = SHIELD
else if (!equal(class, g_wbox_class))
return FMRES_IGNORED
new cvar_state = 7
new cvar_teams = 3
new cvar_allow = get_pcvar_num(g_pcvar_allow)
if (cvar_state <= 0 || cvar_teams <= 0)
return FMRES_IGNORED
new state_, team
if (!is_user_connected(id)) {
state_ = FLAG_DISCONNECT
team = FLAG_T // on disconnect only T can drop weapon (the bomb only)
}
else if (!is_user_alive(id))
state_ = FLAG_DEAD
else
state_ = FLAG_ALIVE
if (!(cvar_state & state_))
return FMRES_IGNORED
if (state_ != FLAG_DISCONNECT) {
switch (cs_get_user_team(id)) {
case CS_TEAM_T : team = FLAG_T
case CS_TEAM_CT: team = FLAG_CT
}
}
if (!(cvar_teams & team))
return FMRES_IGNORED
if (weapon == SHIELD) {
if (!CONTAIN_FLAG_OF_INDEX(cvar_allow, SHIELD)) {
set_pev(ent, pev_effects, EF_NODRAW)
set_task(0.1, "task_remove_shield", ent) // we even can't use nextthink, that will not work
}
return FMRES_IGNORED
}
for (new i = g_max_clients + 1; i < g_max_entities; ++i) {
if (!pev_valid(i) || ent != pev(i, pev_owner))
continue
if (!CONTAIN_FLAG_OF_INDEX(cvar_allow, cs_get_weapon_id(i)))
dllfunc(DLLFunc_Think, ent)
return FMRES_IGNORED
}
}
return FMRES_IGNORED
}
public task_remove_shield(ent)
{
if(wup_on && get_pcvar_num(mode) == 1 || wup_on && get_pcvar_num(mode) == 2)
{
dllfunc(DLLFunc_Think, ent)
}
}
public TaskCheckAlive(plr)
{
if( !g_can_respawn )
{
return;
}
new CsTeams:team = cs_get_user_team(plr);
if( team == CS_TEAM_UNASSIGNED || team == CS_TEAM_SPECTATOR )
{
set_task(1.0, "TaskCheckAlive", plr);
return;
}
if( g_is_dead )
{
ExecuteHamB(Ham_CS_RoundRespawn, plr);
}
}
public client_putinserver(plr)
{
if( wup_on )
{
set_task(2.0, "connectrespawn", plr);
g_is_connect = true;
}
}
public connectrespawn(plr)
{
if( !g_can_respawn )
{
return;
}
new CsTeams:team = cs_get_user_team(plr);
if( team == CS_TEAM_UNASSIGNED || team == CS_TEAM_SPECTATOR )
{
set_task(1.0, "connectrespawn", plr);
return;
}
if( g_is_connect )
{
ExecuteHamB(Ham_CS_RoundRespawn, plr);
g_is_connect = false;
}
}
public client_disconnect(plr)
{
remove_task(plr);
}
public FwdPlayerDeath(plr)
{
g_is_dead = true;
if(get_pcvar_num(respawn3d) == 1)
{
set_task(2.0, "TaskCheckAlive", plr);
}
if(wup_on && get_pcvar_num(mode) == 1 || wup_on && get_pcvar_num(mode) == 2)
{
if (!(7 & FLAG_DEAD) || !(3 & FLAG_CT) || !cs_get_user_defuse(plr))
return
if (CONTAIN_FLAG_OF_INDEX(get_pcvar_num(g_pcvar_allow), DEFUSER))
return
cs_set_user_defuse(plr, 0)
set_pev(plr, pev_body, 0) // backward compatibility
}
}
/*
public EventRoundStart()
{
if( wup_on )
{
set_task(0.1, "FwdPlayerSpawn")
}
}
*/
public FwdPlayerSpawn(plr)
{
if( is_user_alive(plr))
{
g_is_dead = false;
if( g_can_respawn && wup_on && get_pcvar_num(timeprotect) != 0 )
{
set_task(0.1, "wup_protect", plr)
}
if( wup_on && get_pcvar_num(mode) == 1 || wup_on && get_pcvar_num(mode) == 2)
{
cs_set_user_money(plr, 0)
HideMoney(plr)
}
if(wup_on && get_pcvar_num(mode) == 1)
{
new rand = random_num(1,sizeof(g_weapon_names) -1);
fm_strip_user_weapons(plr)
fm_give_item(plr, "weapon_knife")
fm_give_item(plr, g_weapon_names);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
fm_give_item(plr, g_weapon_ammo);
set_task(0.1, "giveitems", plr)
}
}
}
public wup_protect(plr)
{
new Float:ProtecTime = get_pcvar_float(timeprotect)
if( wup_on && get_pcvar_num(timeprotect) != 0 )
{
if(get_user_team(plr) == 1)
{
set_user_rendering(plr, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 26)
set_user_godmode(plr, 1)
}
if(get_user_team(plr) == 2)
{
set_user_rendering(plr, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 26)
set_user_godmode(plr, 1)
}
set_task(ProtecTime, "desprotect", plr)
}
}
public desprotect(plr)
{
if( get_pcvar_num(timeprotect) != 0 )
{
set_user_rendering(plr, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 26)
set_user_godmode(plr, 0)
}
return PLUGIN_HANDLED
}
public giveitems(plr)
{
new iFlags = get_item_flags()
new CsTeams:team = cs_get_user_team(plr);
if( g_items )
{
if (iFlags&ITEM_HE)
{
fm_give_item(plr,"weapon_hegrenade")
}
if(iFlags&ITEM_FS)
{
fm_give_item(plr,"weapon_flashbang")
}
if(iFlags&ITEM_SG)
{
fm_give_item(plr,"weapon_smokegrenade")
}
if( team == CS_TEAM_CT && iFlags&ITEM_C4 )
{
fm_give_item(plr, "item_thighpack")
}
if( team == CS_TEAM_T && iFlags&ITEM_C4 )
{
fm_give_item(plr, "weapon_c4")
cs_set_user_plant(plr, 1, 1)
}
}
}
public check_change(plr)
{
if(get_pcvar_num(mode) == 2)
{
if( g_cuchi )
{
new wpnid = read_data(2)
if( !(wpnid ==CSW_KNIFE || wpnid ==CSW_HEGRENADE || wpnid ==CSW_FLASHBANG || wpnid ==CSW_SMOKEGRENADE || wpnid ==CSW_C4) )
{
set_task(0.1, "remove", plr);
cs_set_user_money(plr, 0);
HideMoney(plr)
}
}
}
}
public remove(plr)
{
fm_strip_user_weapons(plr)
fm_give_item(plr,"weapon_knife")
cs_set_user_money(plr, 0);
set_task(0.1, "giveitems", plr)
}
public HideMoney(plr)
{
if( wup_on && get_pcvar_num(mode) == 1 || wup_on && get_pcvar_num(mode) == 2)
{
message_begin( MSG_ONE, g_iMsg_HideWeapon, _, plr );
write_byte( HIDE_MONEY );
message_end();
}
if( !(wup_on) || get_pcvar_num(mode) == 0)
{
message_begin( MSG_ONE, g_iMsg_HideWeapon, _, plr );
write_byte( SHOW_MONEY );
message_end();
}
}
还有这些- - 真长
public admin_exec1(plr)
{
if(!access(plr, ADMIN_BAN))
{
client_print(plr, print_console, " You do not have access to this command")
return PLUGIN_HANDLED
}
set_cvar_float("sv_restartround",1.0);
g_can_respawn = false;
g_cuchi = false;
g_items = false;
wup_on = false;
remove_task(plr);
client_print(plr, print_console, " WarmUP Pro DISABLED")
client_print(0, print_chat, " WarmUP Pro DISABLED")
return PLUGIN_HANDLED
}
public admin_exec2(plr)
{
if(!access(plr, ADMIN_BAN))
{
client_print(plr, print_console, " You do not have access to this command")
return PLUGIN_HANDLED
}
set_cvar_float("sv_restartround",1.0);
time_s = get_pcvar_num(num_time)
set_task(float(time_delay),"restart_time")
g_can_respawn = true;
g_cuchi = true;
g_items = true;
wup_on = true;
new iFlags = get_item_flags()
if( !(iFlags&ITEM_C4) )
{
set_pcvar_num(g_pcvar_allow, 64)
}
client_print(plr, print_console, " WarmUP Pro Enable")
client_print(0, print_chat, " WarmUP Pro Enable")
return PLUGIN_HANDLED
}
public autostartrr(plr)
{
if(get_pcvar_num(activadoo) == 0)
{
g_can_respawn = false;
g_cuchi = false;
g_items = false;
wup_on = false;
remove_task(plr);
}
if(get_pcvar_num(activadoo) == 1)
{
time_s = get_pcvar_num(num_time)
set_task(float(time_delay),"restart_time")
wup_on = true;
g_can_respawn = true;
g_cuchi = true;
g_items = true;
new iFlags = get_item_flags()
if( !(iFlags&ITEM_C4) )
{
set_pcvar_num(g_pcvar_allow, 64)
}
}
}
public restart_time()
{
new color
new r
new g
new b
get_pcvar_string(RGB, color, 9)
new c = str_to_num(color)
r = c / 1000000
c %= 1000000
g = c / 1000
b = c % 1000
if(wup_on && time_s >= 0)
{
ClearSyncHud(0, sync)
if(time_s < 1)
{
set_cvar_float("sv_restartround",2.0);
g_can_respawn = false;
g_cuchi = false;
g_items = false;
}
if(time_s == 0)
{
wup_on = false;
set_user_rendering(0, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 26)
set_user_godmode(0, 0)
}
set_hudmessage( r, g, b, get_pcvar_float(cvar_x), get_pcvar_float(cvar_y), 1, 6.0, 6.0);
ShowSyncHudMsg(0, sync, "%L", LANG_PLAYER, "MP_DISPLAY", time_s);
--time_s;
set_task(1.0,"restart_time")
}
return PLUGIN_HANDLED;
}
还处罚了啊:L
页:
[1]
2