To tak zaczynajmy !
Dla Klasy
Stworzymy przykładową klasę o Nazwie Skoczek
Szkielet:
#include <amxmodx>
#include <amxmisc>
#include <codmod>
new const nazwa[] = "Skoczek";
new const opis[] = "Klasa Testowa Posiada LongJumpa Co x Sekund";
new const bronie = 0;
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
public plugin_init()
{
register_plugin(nazwa, "1.0", "Amxx.pl");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
}
Na początku dodajemy includy:
#include <fakemeta>
#include <fun>
#include <engine>
Potem dodajemy:
new player_b_froglegs[33] = 1;
new ma_klase[33];
W Public Plugin Init Tworzymy Forward:
register_forward(FM_PlayerPreThink, "Prethink_froglegs");
Kolejno dodajemy 2 Publiki
1.
public cod_class_enabled(id)
{
ma_klase[id] = true;
}
2.
public cod_class_disabled(id)
{
ma_klase[id] = false;
}
I dajemy na Koniec SMA:
public Prethink_froglegs(id)
{
if(!ma_klase[id])
return PLUGIN_CONTINUE
if (get_user_button(id) & IN_DUCK)
{
if (player_b_froglegs[id] == 1)
{
player_b_froglegs[id] = floatround(halflife_time())
}
else
{
if (floatround(halflife_time())-player_b_froglegs[id] >= X) // Tutaj podajemy czas zamiast X
{
new Float:fl_iNewVelocity[3]
VelocityByAim(id, 1000, fl_iNewVelocity)
fl_iNewVelocity[2] = 210.0
entity_set_vector(id, EV_VEC_velocity, fl_iNewVelocity)
player_b_froglegs[id] = 1
}
}
}
else
{
player_b_froglegs[id] = 1
}
}
Gdzie X podajemy czas Np. 3.0 = co 3 sekundy
I Nasze SMA powinno wyglądać tak :
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <fakemeta>
#include <fun>
#include <engine>
new const nazwa[] = "Skoczek";
new const opis[] = "Klasa Testowa Posiada LongJumpa Co x Sekund";
new const bronie = 0;
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
new player_b_froglegs[33];
new ma_klase[33];
public plugin_init()
{
register_plugin(nazwa, "1.0", "Amxx.pl");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
register_forward(FM_PlayerPreThink, "Prethink_froglegs");
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
}
public Prethink_froglegs(id)
{
if(!ma_klase[id])
return PLUGIN_CONTINUE
if (get_user_button(id) & IN_DUCK)
{
//start holding down button here, set to halflife time
if (player_b_froglegs[id] == 1)
{
player_b_froglegs[id] = floatround(halflife_time())
}
else
{
if (floatround(halflife_time())-player_b_froglegs[id] >= 3.0)
{
new Float:fl_iNewVelocity[3]
VelocityByAim(id, 1000, fl_iNewVelocity)
fl_iNewVelocity[2] = 210.0
entity_set_vector(id, EV_VEC_velocity, fl_iNewVelocity)
player_b_froglegs[id] = 1
}
}
}
else
{
player_b_froglegs[id] = 1
}
}
Dla Itemu:
Stworzymy przykładowy item o nazwie Tajemnica Skoczka
Nasz szkielet :
#include <amxmodx>
#include <hamsandwich>
#include <codmod>
#include <fakemeta>
#include <fun>
#include <engine>
[new const perk_name[] = "Tajemnica Skoczka";
new const perk_desc[] = "Robisz Long Jumpy co 3 sekundy";
public plugin_init()
{
register_plugin(perk_name, "1.0", "Amxx.PL");
cod_register_perk(perk_name, perk_desc);
}
Kolejno dodajemy
new bool:ma_perk[33];
new player_b_froglegs[33];
Oraz :
public cod_perk_enabled(id)
{
ma_perk[id] = true;
}
public cod_perk_disabled(id)
{
ma_perk[id] = false;
}
Tworzymy Forwarda :
register_forward(FM_PlayerPreThink, "Prethink_froglegs");
i Dodajemy na koniec SMA:
public Prethink_froglegs(id)
{
if(!ma_perk[id])
return PLUGIN_CONTINUE
if (get_user_button(id) & IN_DUCK)
{
//start holding down button here, set to halflife time
if (player_b_froglegs[id] == 1)
{
player_b_froglegs[id] = floatround(halflife_time())
}
else
{
if (floatround(halflife_time())-player_b_froglegs[id] >= 2.0)
{
new Float:fl_iNewVelocity[3]
VelocityByAim(id, 1000, fl_iNewVelocity)
fl_iNewVelocity[2] = 210.0
entity_set_vector(id, EV_VEC_velocity, fl_iNewVelocity)
player_b_froglegs[id] = 1
}
}
}
else
{
player_b_froglegs[id] = 1
}
}
I wychodz nam coś takiego :
#include <amxmodx>
#include <hamsandwich>
#include <codmod>
#include <fakemeta>
#include <fun>
#include <engine>
new const perk_name[] = "Tajemnica Skoczka";
new const perk_desc[] = "Robisz Long Jumpy co 3 sekundy";
new bool:ma_perk[33];
new player_b_froglegs[33] = 1;
public plugin_init()
{
register_plugin(perk_name, "1.0", "Amxx.PL");
cod_register_perk(perk_name, perk_desc);
register_forward(FM_PlayerPreThink, "Prethink_froglegs");
}
public cod_perk_enabled(id)
{
ma_perk[id] = true;
}
public cod_perk_disabled(id)
{
ma_perk[id] = false;
}
public Prethink_froglegs(id)
{
if(!ma_perk[id])
return PLUGIN_CONTINUE
if (get_user_button(id) & IN_DUCK)
{
if (player_b_froglegs[id] == 1)
{
player_b_froglegs[id] = floatround(halflife_time())
}
else
{
if (floatround(halflife_time())-player_b_froglegs[id] >= 2.0)
{
new Float:fl_iNewVelocity[3]
VelocityByAim(id, 1000, fl_iNewVelocity)
fl_iNewVelocity[2] = 210.0
entity_set_vector(id, EV_VEC_velocity, fl_iNewVelocity)
player_b_froglegs[id] = 1
}
}
}
else
{
player_b_froglegs[id] = 1
}
}
Mam nadzieję że Komuś się przyda jak ktoś bd takiego czegoś szukał bo mi pomocy nie udzielono
Pozdrawiam !
Użytkownik Majster VVirus edytował ten post 03.12.2011 15:35