Главная | Поиск | Чат | Форум | Рынок | | Регистрация | Вход
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]

Уважаемые пользователи, прежде чем открыть новую тему ознакомьтесь пожалуйста с правилами и воспользуйтесь поиском.

Страница 1 из 11
Модератор форума: Cooller^_^, Mushroom, Tiger_ 
Форум Counter Strike » Плагины для AMXX » Общие вопросы по модам и плагинам » Помогите с плагином
Помогите с плагином
Shot-DenДата: Вторник, 2012-04-03, 13:27 | Сообщение # 1
Сообщений: 94
Награды: 2
Как зделать что б кт давалися glock и патрони к нему(в режиме Invis). Вот исходник:
Quote
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new free, invis, fi_touch, rounds = 1, last_round_free, last_round_invis , button_used[33], msgSayText, cvar_time, cvar_rounds_free, cvar_rounds_invis, cvar_free, cvar_free_health, cvar_invis, cvar_invis_health, cvar_hudmsgs, cvar_button, msgSync

/*Thanks to PomanoB for the help with weaponbox and armoury_entity*/

public plugin_init()
{
register_plugin("[DR] Free | Invis", "3.1", "WPMG|TEAM")
register_clcmd("say", "cmd_say")
register_clcmd("say_team", "cmd_say")
RegisterHam(Ham_Touch, "weaponbox", "fd_TouchWeapon") /*Thanks to PomanoB for the help with weaponbox and armoury_entity*/
RegisterHam(Ham_Touch, "armoury_entity", "fd_TouchWeapon") /*Thanks to PomanoB for the help with weaponbox and armoury_entity*/
RegisterHam(Ham_Touch, "weapon_shield", "fd_TouchWeapon")
RegisterHam(Ham_Use, "func_button", "fd_UseButton")
RegisterHam(Ham_Spawn, "player", "fd_PlayerSpawn_Post", 1)
RegisterHam(Ham_Killed, "player", "fd_PlayerKilled")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("DeathMsg", "event_deathmsg", "a")
register_logevent("logevent_round_start", 2, "1=Round_Start")
cvar_time = register_cvar("dr_fi_time", "60")
cvar_rounds_free = register_cvar("dr_free_rounds", "3")
cvar_rounds_invis = register_cvar("dr_invis_rounds", "3")
cvar_free = register_cvar("dr_free", "1")
cvar_free_health = register_cvar("dr_free_health", "0")
cvar_invis = register_cvar("dr_invis", "1")
cvar_invis_health = register_cvar("dr_invis_health", "200")
cvar_hudmsgs = register_cvar("dr_fi_hudmsgs", "1")
cvar_button = register_cvar("dr_fi_buttonused", "0")
register_dictionary("dr_free_invis.txt")
msgSayText = get_user_msgid("SayText")
msgSync = CreateHudSyncObj()
}

public event_round_start()
{
free = 0
invis = 0
remove_task(10123)
fi_touch = 2
rounds++
static i
for(i = 1; i <= 32; i++)
button_used[i] = 0
}

public logevent_round_start()
{
fi_touch = 1
set_task(get_pcvar_float(cvar_time), "cant_touch", 10123)
}

public cant_touch()
fi_touch = 0

public cmd_say(id)
{
static arg1[128]
read_argv(1, arg1, 127)
remove_quotes(arg1)
static rounds_need
if(equal(arg1, "/free") || equal(arg1, "free"))
{
rounds_need = last_round_free + get_pcvar_num(cvar_rounds_free) + 1
if(!get_pcvar_num(cvar_free))
return
else if(get_user_team(id) != 1)
return
else if(!is_user_alive(id))
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_ALIVE")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(invis)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_INVIS")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(free)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_TOUCHED")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(last_round_free && (rounds_need > rounds))
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_ROUNDS", rounds_need-rounds)
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(!fi_touch)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_TIME")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(fi_touch == 2)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_SROUND")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(button_used[id] && get_pcvar_num(cvar_button))
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_FREE_BUTTONUSED")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
static i
for(i=1; i<=32; i++)
if(is_user_alive(i))
if(get_user_team(i) == 2)
{
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
if (pev_valid(ent))
{
dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, i)
engfunc(EngFunc_RemoveEntity, ent)
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "weapon_knife"))
if (pev_valid(ent))
{
static Float:originF[3]
pev(i, pev_origin, originF)
set_pev(ent, pev_origin, originF)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)
static save
save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, i)
if (pev(ent, pev_solid) == save)
engfunc(EngFunc_RemoveEntity, ent)
}
}
}
if(get_pcvar_num(cvar_hudmsgs))
{
set_hudmessage(20, 255, 20, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, msgSync, "%L", -1, "DR_FREE_START")
}
else
client_print(0, print_center, "%L", -1, "DR_FREE_START")
last_round_free = rounds
free = 1
}
else if(equal(arg1, "/invis") || equal(arg1, "invis"))
{
rounds_need = last_round_invis + get_pcvar_num(cvar_rounds_invis) + 1
if(!get_pcvar_num(cvar_invis))
return
else if(get_user_team(id) != 1)
return
else if(!is_user_alive(id))
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_ALIVE")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(free)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_FREE")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(invis)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_TOUCHED")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(last_round_invis && (rounds_need > rounds))
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_ROUNDS", rounds_need-rounds)
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(!fi_touch)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_TIME")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(fi_touch == 2)
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_SROUND")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
else if(button_used[id] && get_pcvar_num(cvar_button))
{
formatex(arg1, 127, "^x04[DR]^x01 %L", id, "DR_INVIS_BUTTONUSED")
message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
write_byte(id)
write_string(arg1)
message_end()
return
}
set_pev(id, pev_health, get_pcvar_float(cvar_invis_health))
set_pev(id, pev_renderfx, 19)
set_pev(id, pev_rendercolor, {0.0, 0.0, 0.0})
set_pev(id, pev_rendermode, 4)
set_pev(id, pev_renderamt, 0.0)
if(get_pcvar_num(cvar_hudmsgs))
{
set_hudmessage(20, 255, 20, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, msgSync, "%L", -1, "DR_INVIS_START")
}
else
client_print(0, print_center, "%L", -1, "DR_INVIS_START")
last_round_invis = rounds
invis = 1
}
}
public fd_TouchWeapon(ent, id)
{
if(!is_user_alive(id) || (!free && !invis))
return HAM_IGNORED
static classname[16]; pev(ent, pev_classname, classname, 15)
if(equal(classname, "weaponbox")) /*Thanks to PomanoB for the help with weaponbox and armoury_entity*/
{
static model[32]; pev(ent, pev_model, model, 31)
if(get_user_team(id) == 2 && equal(model, "models/w_usp.mdl") && !free)
return HAM_IGNORED
}
return HAM_SUPERCEDE
}
public fd_UseButton(ent, caller, id)
{
if(!is_user_alive(id))
return HAM_IGNORED

if(get_user_team(id) == 1)
{
if(free)
client_print(id, print_center, "%L", id, "DR_FREE_BUTTON")
else if(invis)
client_print(id, print_center, "%L", id, "DR_INVIS_BUTTON")
else
{
button_used[id] = 1
return HAM_IGNORED
}
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public fd_PlayerSpawn_Post(id)
{
if(!is_user_alive(id))
return

set_pev(id, pev_renderfx, 0)
set_pev(id, pev_rendercolor, {255.0, 255.0, 255.0})
set_pev(id, pev_rendermode, 0)
set_pev(id, pev_renderamt, 16.0)

if(free)
set_task(2.0, "task_removewpn", 1024 + id)
}
public fd_PlayerKilled(id)
{
set_pev(id, pev_renderfx, 0)
set_pev(id, pev_rendercolor, {255.0, 255.0, 255.0})
set_pev(id, pev_rendermode, 0)
set_pev(id, pev_renderamt, 16.0)
}
public client_disconnect(id)
remove_task(1024 + id)
public event_deathmsg(id)
{
static attacker, victim
attacker = read_data(1)
victim = read_data(2)
remove_task(1024 + victim)
if(victim == attacker || !is_user_alive(attacker) || !free || !get_pcvar_num(cvar_free_health))
return
if(get_user_team(attacker) != 1)
return
set_pev(attacker, pev_health, 100.0)
}
public task_removewpn(taskid)
{
static id; id = taskid - 1024
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
if (pev_valid(ent))
{
dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, id)
engfunc(EngFunc_RemoveEntity, ent)
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "weapon_knife"))
if (pev_valid(ent))
{
static Float:originF[3]
pev(id, pev_origin, originF)
set_pev(ent, pev_origin, originF)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)
static save
save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, id)
if (pev(ent, pev_solid) == save)
engfunc(EngFunc_RemoveEntity, ent)
}
}
}

Добавлено (2012-04-03, 13:27)
---------------------------------------------
Проблема решена :D , можно закрывать тему

Сообщение отредактировал Shot-Den - Понедельник, 2012-04-02, 17:11
 Российская Федерация
Форум Counter Strike » Плагины для AMXX » Общие вопросы по модам и плагинам » Помогите с плагином
Страница 1 из 11
Поиск:
Статистика Форума
Последние темы Читаемые темы Лучшие пользователи Новые пользователи

Ищу человека который поможет настроить сервер

(4)

Проблема общего характера с knife dm

(0)

Ищу скрипт

(1)

проблемка с фпс/пингом

(5)

Быстрая закупка CS 1.6

(6)

Общение:> (закрыта)

(9999)

Общение ^-^

(9999)

Общение :] (закрыта)

(9728)

Флудилочка дизайнеров :)

(5926)

Досчитаем до 10000:)

(4757)

Cooller^_^

(6318)

REDtooth

(2547)

Gep

(2421)

redemaxa

(2162)

cs-strikez

(2010)

olehmelnyk777

(2016-12-05)

chuchukmasll

(2016-12-05)

Trumpflum

(2016-12-05)

goshan355marchenco

(2016-12-05)

HuKcOH™

(2016-12-04)

Популярные