#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <zombieplague>
new g_sniper[33] // is sniper
new g_sniperround // sniper round
new cvar_sniper, cvar_sniperchance, cvar_sniperminplayers, cvar_sniperdamage
const ACCESS_FLAG = ADMIN_BAN // to access the admin menu
public plugin_init()
{
// Register plugin call
register_plugin("[ZP] Sub-Plugin: Sniper", "1.0", "93()|29!/<")
register_concmd("zp_sniper", "cmd_sniper", ACCESS_FLAG, " - Turn someone into a Sniper")
// CVARS - Sniper
cvar_sniper = register_cvar("zp_sniper_enabled", "1")
cvar_sniperchance = register_cvar("zp_sniper_chance", "20")
cvar_sniperminplayers = register_cvar("zp_sniper_min_players", "2")
cvar_sniperdamage = register_cvar("zp_sniper_damage", "11575")
}
enum
{
MODE_SNIPER
}
public event_round_start()
{
// New round starting
g_sniperround = false
}
public takedamage(victim, inflictor, attacker, Float:damage, damagetype)
{
if (g_sniper[attacker] && g_sniperround && get_user_weapon(attacker) == CSW_AWP)
{
// Set sniper damage
SetHamParamFloat(4, get_pcvar_float(cvar_sniperdamage))
return HAM_IGNORED;
}
return HAM_HANDLED
}
// zp_sniper
public cmd_sniper(id, level, cid)
{
// Check for access flag
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED;
// Swarm mode not allowed
if (!allowed_swarm())
{
client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
return PLUGIN_HANDLED;
}
command_sniper(id)
return PLUGIN_HANDLED;
}
// Make a Zombie Function
make_a_zombie(mode, id)
else if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_SNIPER) && random_num(1, get_pcvar_num(cvar_sniperchance)) == get_pcvar_num(cvar_sniper) && iPlayersnum >= get_pcvar_num(cvar_sniperminplayers)) || mode == MODE_SNIPER)
{
// Survivor Mode
g_survround = true
g_sniperround = true
g_lastmode = MODE_SNIPER
// Choose player randomly?
id = fnGetRandomAlive(random_num(1, iPlayersnum))
// Remember id for calling our forward later
forward_id = id
// MAKE SNIPER
g_sniper[id] = true
humanme(id, 1)
fm_strip_user_weapons(id)
fm_give_item(id, "weapon_knife")
fm_give_item(id, "weapon_awp")
// FINISH SNIPER
// Turn the rest of players into zombies
for (id = 1; id <= g_maxplayers; id++)
{
// Not alive
if (!is_user_alive(id))
continue;
// Survivor or already a zombie
if (g_survivor[id] || g_zombie[id])
continue;
// Turn into a zombie
zombieme(id, 0, 0, 1)
}
// Play survivor sound
// Get player's name
get_user_name(forward_id, name, sizeof name - 1)
// Show Survivor HUD notice
set_hudmessage(20, 20, 255, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SNIPER", name)
// Round start forward
ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SNIPER, forward_id);
}
reset_vars(id, resetall)
{
g_sniper[id] = false
}
public ShowHUD(taskid)
{
else // humans
{
red = 0
green = 0
blue = 255
if (g_sniper[id])
formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_SNIPER")
if (g_survivor[id])
formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_SURVIVOR")
else
formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_HUMAN")
}
}
// Admin Command. zp_sniper
command_sniper(id)
{
static name1[32]
get_user_name(id, name1, sizeof name1 - 1)
// Show activity?
switch (get_pcvar_num(cvar_showactivity))
{
case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_SNIPER")
case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_SNIPER")
}
// Log to Zombie Plague log file?
if (get_pcvar_num(cvar_logcommands))
{
static logdata[100], authid[32], ip[16]
get_user_authid(id, authid, sizeof authid - 1)
get_user_ip(id, ip, sizeof ip - 1, 1)
formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER, "CMD_SWARM", fnGetPlaying(), g_maxplayers)
log_to_file("zombieplague.log", logdata)
}
// Call Swarm Mode
remove_task(TASK_MAKEZOMBIE)
make_a_zombie(MODE_SNIPER, 0)
}
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Prośba o sprawdzenie pluga...
Temat rozp. Paldziu, 30.08.2009 12:53
3 odpowiedzi w tym temacie
#1
Napisano 30.08.2009 12:53
#2
Napisano 30.08.2009 13:03
hehe ale co mamy sprawdzić co ci nie działa
?
a i kody pluginów dajemy w czymś takim:
a i kody pluginów dajemy w czymś takim:
asdtaki przycisk code
#3
Napisano 30.08.2009 13:07
to macie pomóc że mam cytuje "linia jest za długa", a nie wiem jak temu zaradzić...
EDIT:
Oho, zmieniłem jeden myk i oto co mam:
EDIT:
Oho, zmieniłem jeden myk i oto co mam:
/groups/amxmodx/tmp3/textwX2ftk.sma(54) : error 017: undefined symbol "allowed_swarm" /groups/amxmodx/tmp3/textwX2ftk.sma(67) : error 029: invalid expression, assumed zero /groups/amxmodx/tmp3/textwX2ftk.sma(67) : warning 215: expression has no effect /groups/amxmodx/tmp3/textwX2ftk.sma(67) : error 001: expected token: ";", but found "if" /groups/amxmodx/tmp3/textwX2ftk.sma(70) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(75) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(78) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(81) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(84) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(85) : error 088: number of arguments does not match definition /groups/amxmodx/tmp3/textwX2ftk.sma(90) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(93) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(94) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(97) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(98) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(101) : error 010: invalid function or declaration /groups/amxmodx/tmp3/textwX2ftk.sma(107) : error 021: symbol already defined: "get_user_name" /groups/amxmodx/tmp3/textwX2ftk.sma(110) : error 021: symbol already defined: "set_hudmessage" /groups/amxmodx/tmp3/textwX2ftk.sma(114) : error 021: symbol already defined: "ExecuteForward" /groups/amxmodx/tmp3/textwX2ftk.sma(124) : error 029: invalid expression, assumed zero /groups/amxmodx/tmp3/textwX2ftk.sma(126) : error 017: undefined symbol "red" /groups/amxmodx/tmp3/textwX2ftk.sma(126 -- 127) : warning 215: expression has no effect /groups/amxmodx/tmp3/textwX2ftk.sma(127) : error 017: undefined symbol "green" /groups/amxmodx/tmp3/textwX2ftk.sma(127 -- 128) : warning 215: expression has no effect /groups/amxmodx/tmp3/textwX2ftk.sma(128) : error 017: undefined symbol "blue" /groups/amxmodx/tmp3/textwX2ftk.sma(128) : fatal error 107: too many error messages on one line
#4
Napisano 30.08.2009 17:24
Oto kilka, które zauważyłem, zanim zrozumiałem, że nie umiesz pisać pluginów.
źle zorganizowane bloki { }
rozpoczynanie porównania od "esle if"
brak deklaracji stałych i zmiennych
źle zorganizowane bloki { }
rozpoczynanie porównania od "esle if"
brak deklaracji stałych i zmiennych
Użytkownicy przeglądający ten temat: 1
0 użytkowników, 1 gości, 0 anonimowych


Dodatki SourceMod



Temat jest zamknięty









