#include <amxmodx>
#include <zombieplague>
#include <fun>
#include <cstrike>
new cvar_gravity, cvar_health, cvar_armor, cvar_speed, cvar_red,
cvar_green, cvar_blue, cvar_ammount, cvar_glow, cvar_weapons,
cvar_nade, cvar_givenade, g_itemid, cvar_sound, cvar_soundfile
new bool:speed[33]
// colorchat
enum Color {
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new TeamName[][] = {
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
// colorchat end
public plugin_init() {
register_plugin("[ZP] Extra Item: [Pro-Gammer]", "v1.2", "Raddish")
g_itemid = zp_register_extra_item("【强化套装】", 150, ZP_TEAM_HUMAN)
register_event("CurWeapon","change_weapon","be","1=1")
// Cvars
cvar_health = register_cvar("zp_progammer_health", "250"); // Health
cvar_gravity = register_cvar("zp_progammer_gravity", "0.5"); // Gravity
cvar_armor = register_cvar("zp_progammer_armor", "500"); // Armor
cvar_speed = register_cvar("zp_progammer_speed", "400"); // Speed
cvar_glow = register_cvar("zp_progammer_glow", "1"); // Glow on/off
cvar_red = register_cvar("zp_progammer_glow_red", "255"); // Red
cvar_green = register_cvar("zp_progammer_glow_green", "0"); // Green
cvar_blue = register_cvar("zp_progammer_glow_blue", "0"); // Blue
cvar_ammount = register_cvar("zp_progammer_glow_ammount", "10"); // Ammount
cvar_weapons = register_cvar("zp_progammer_give_weapons", "1"); // Give Weapons
cvar_givenade = register_cvar("zp_progammer_give_nades", "1"); // Give Nades
cvar_nade = register_cvar("zp_progammer_nade_count", "1") // Give Number of nade
cvar_sound = register_cvar("zp_progammer_sound", "1") // Sound ON/OFF
cvar_soundfile = register_cvar("zp_progammer_soundfile", "sound/zombie_plague/survivor2.wav") // File Sound
}
public zp_extra_item_selected(id, itemid) {
if(!is_user_alive(id) || itemid == g_itemid) {
// Hud Message
new name[32]
get_user_name(id, name, 32)
set_hudmessage(255, 255, 0, 0.05, random_float(0.35, 0.60), 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "%s buy [Pro-Gammer]", name)
// Color Print.
new username[33]
ColorChat(id, GREEN, "^x04[Pro-Gammer] ^x03The player %s buy a Pro-Gammer", get_user_name(id, username, 32))
// Set Options
set_user_health(id, get_user_health(id) + get_pcvar_num(cvar_health))
set_user_armor(id, get_user_armor(id) + get_pcvar_num(cvar_armor))
set_user_gravity(id, get_user_gravity(id) - get_pcvar_float(cvar_gravity))
speed[id] = true
// Turn Glow On/Off
if (get_pcvar_num(cvar_glow)) {
set_user_rendering(id, kRenderFxGlowShell, cvar_red, cvar_green, cvar_blue, kRenderNormal, get_pcvar_num(cvar_ammount))
}
// Give Weapons
if(get_pcvar_num(cvar_weapons)) {
strip_user_weapons(id)
give_item(id, "weapon_m249")
cs_set_user_bpammo(id, CSW_M4A1, 90)
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 30)
// Give Nades
if(get_pcvar_num(cvar_givenade)) {
give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num(cvar_nade))
give_item(id, "weapon_hegrenade")
cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(cvar_nade))
give_item(id, "weapon_smokegrenade")
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, get_pcvar_num(cvar_nade))
}
}
if (get_pcvar_num(cvar_sound)) {
new sound_file[50]
get_pcvar_string(cvar_soundfile, sound_file, charsmax(sound_file))
client_cmd(id, "spk %s", get_pcvar_float(cvar_soundfile))
}
}
}
public start () {
speed[0] = false
strip_user_weapons(0)
set_user_health(0, 100)
set_user_armor(0, 0)
set_user_gravity(0, 1.0)
set_user_maxspeed(0, 250.0)
}
public change_weapon(id) {
if(speed[id]) {
set_user_maxspeed(id, get_user_maxspeed(id) + get_pcvar_float (cvar_speed))
}
}
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) {
if( !get_playersnum() ) return;
new message[256];
switch(type) {
case NORMAL:
{
message[0] = 0x01;
}
case GREEN:
{
message[0] = 0x04;
}
default:
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id) {
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange) {
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[]) {
static bool:saytext_used;
static get_user_msgid_saytext;
if(!saytext_used){
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = true;
}
message_begin(type, get_user_msgid_saytext, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[]){
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
if(!teaminfo_used){
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = true;
}
message_begin(type, get_user_msgid_teaminfo, _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type){
switch(Type){
case RED:{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:{
return Team_Info(index, type, TeamName[2]);
}
case GREY:{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer(){
new i = -1;
while(i <= get_maxplayers()){
if(is_user_connected(++i))
return i;
}
return -1;
}
是否要在底下加入 (這樣的話我實在想不透)....