Szybkosc i HP w klasie
wickedmaks
24.01.2015
Dlaczego tutaj nie dziala HP i szybkosc poruszania sie klasy?
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <hamsandwich>
#include <fun>
#define DMG_BULLET (1<<1)
new bool:ma_klase[33];
new const nazwa[] = "Komandos";
new const opis[] = "Natychmiastowe zabicie z noza(PPM)";
new const bronie = (1<<CSW_SMOKEGRENADE)|(1<<CSW_USP)|(1<<CSW_DEAGLE);
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
public plugin_init()
{
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
set_user_maxspeed(id,get_user_maxspeed(id)+get_user_maxspeed(id)*0.4);
set_user_health(id, 130)
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
set_user_maxspeed(id,get_user_maxspeed(id)+get_user_maxspeed(id));
set_user_health(id, 100)
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_KNIFE && damagebits & DMG_BULLET && damage > 20.0)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
wickedmaks
24.01.2015
To jak to zrobic, zeby klasa miala 130 hp i 140% kondycji, bez dodawania w statystyki?
Wielkie Jol
24.01.2015
Ustaw to przy spawnie, wcześniej sprawdzając, czy gracz ma klasę i czy żyje.
wickedmaks
24.01.2015
Dziekuje za rade, a jezeli nie potrafie tego zrobic moglbys mi to zmienic i podac kod?
Wielkie Jol
25.01.2015
wickedmaks
25.01.2015
Wyszlo mi cos takiego ale ani HP, ani speed nie dziala.
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <hamsandwich>
#include <fun>
#define DMG_BULLET (1<<1)
new bool:ma_klase[33];
new const nazwa[] = "Komandos";
new const opis[] = "Natychmiastowe zabicie z noza(PPM)";
new const bronie = (1<<CSW_SMOKEGRENADE)|(1<<CSW_USP)|(1<<CSW_DEAGLE);
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
public plugin_init()
{
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
RegisterHam(Ham_Spawn, "player", "Spawn", 1);
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_KNIFE && damagebits & DMG_BULLET && damage > 20.0)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public respawn(id)
{
if(!is_user_alive(id))
return;
if(!ma_klase[id])
return;
new gracz[32]
read_argv(1, gracz, 31)
new player = cmd_target(1, gracz, 31)
set_user_maxspeed(id,get_user_maxspeed(id)+get_user_maxspeed(id)*0.4);
set_user_health(id, 130);
spawn(player)
spawn(player)
}
wickedmaks
25.01.2015
Nie jestem jakis zjaebisty w ogole prawie nie znam tego jezyka ale:
RegisterHam(Ham_Spawn, "player", "Spawn", 1);
if(!is_user_alive(id))
return;
if(!ma_klase[id])
return;
to chyba jest poprawnie?
Wielkie Jol
25.01.2015
Użytkownik Wielkie Jol edytował ten post 25.01.2015 16:46
wickedmaks
25.01.2015
Wow, calkiem niezle idzie, ale:
1. Speed nie dziala (to mozliwe? moze nie odczuwam tego?) //btw. tak na logike to chyba ta komenda ustawia maxspeed a nie speed?
2. HP dodaje ale dopiero jak wpisze kill w konsoli czy po 1 rundzie, nie mozna od razu?
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <hamsandwich>
#include <fun>
#define DMG_BULLET (1<<1)
new bool:ma_klase[33];
new const nazwa[] = "Komandos";
new const opis[] = "Natychmiastowe zabicie z noza(PPM)";
new const bronie = (1<<CSW_SMOKEGRENADE)|(1<<CSW_USP)|(1<<CSW_DEAGLE);
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
public plugin_init()
{
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
RegisterHam(Ham_Spawn, "player", "respawn", 1);
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_KNIFE && damagebits & DMG_BULLET && damage > 20.0)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public respawn(id)
{
if(!is_user_alive(id))
return;
if(!ma_klase[id])
return;
new gracz[32]
read_argv(1, gracz, 31)
new player = cmd_target(1, gracz, 31)
set_user_maxspeed(id,get_user_maxspeed(id)+get_user_maxspeed(id)*0.4);
set_user_health(id, 130);
spawn(player)
spawn(player)
}
Użytkownik wickedmaks edytował ten post 25.01.2015 17:02
Wielkie Jol
25.01.2015
Co do szybkości pewnie nie odczuwasz bo mając podstawowo 250 speeda dodajesz mu ok. 0.4 tej wartości czyli łącznie jest jakieś 380 na oko. Daj sobie np. 1000 to różnice odczujesz. Ponadto do zmiany prędkości gracza polecam sposób BlackPerfuma - szukaj "lepszy sposób zmiany prędkości gracza"
Użytkownik Wielkie Jol edytował ten post 25.01.2015 17:17
wickedmaks
25.01.2015
1. to chyba u mnie na tym sie zabawa konczy, bo tego juz nie potrafie
2. tego kodu jest tyle, ze poszukam innego sposobu, i niestety speed dziala, bo zmierzylem na stoperze ![]()
Użytkownik wickedmaks edytował ten post 25.01.2015 17:20
Wielkie Jol
25.01.2015
1.
public cod_class_enabled(id)
{
ma_klase[id] = true;
set_user_health(id, 130);
}
2. http://amxx.pl/topic...ędkości-gracza/
wickedmaks
25.01.2015
Dobra, uzylem tamtej co wyslales ale nie chce sie kompilowac.
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <hamsandwich>
#include <fun>
#include <fakemeta>
const m_pPlayer = 41
const m_iId = 43
#define DMG_BULLET (1<<1)
new bool:ma_klase[33];
new const nazwa[] = "Komandos";
new const opis[] = "Natychmiastowe zabicie z noza(PPM)";
new const bronie = (1<<CSW_SMOKEGRENADE)|(1<<CSW_USP)|(1<<CSW_DEAGLE);
new const zdrowie = 0;
new const kondycja = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
public plugin_init()
{
new classname[32]
for(new i=1;i<31;++i) if(i!=2)
{
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
RegisterHam(Ham_Spawn, "player", "respawn", 1);
get_weaponname(i,classname,31);
RegisterHam( Ham_CS_Item_GetMaxSpeed, classname, "GetItemMaxSpeed");
}
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
set_user_health(id, 130);
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_KNIFE && damagebits & DMG_BULLET && damage > 20.0)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public respawn(id)
{
if(!is_user_alive(id))
return;
if(!ma_klase[id])
return;
new gracz[32]
read_argv(1, gracz, 31)
new player = cmd_target(1, gracz, 31)
set_user_health(id, 130);
spawn(player)
spawn(player)
}
public GetItemMaxSpeed(wid)
{
new weapon,id,Float:Speed
id = get_pdata_cbase(wid,m_pPlayer,4)
weapon = get_pdata_int(wid,m_iId,4)
if(is_user_alive(id) && ma_klase[id]
{
if(weapon != CSW_C4)
{
Speed = 350.0
}
else
{
Speed = 350.0
}
}
SetHamReturnFloat(Speed)
return HAM_OVERRIDE
}
KarlikAśki
25.01.2015
wpisz w google tam masz komeny ktore w kod mozesx wklepac masz poradnik.
wickedmaks
25.01.2015
Przeciez uzylem poradnika od wielkie jol, to tez jest poprawny, mam tylko problem z kompilowaniem...




