Hello!
Well i have a little problem.
I want to do plugin that enables using spells in TF2, but it's not all cuz i m creating hud to it.
One part of hud is name of spell with number of uses left. (ex. Fireball x5)
The problem is i don't know how to lower this number. I mean i have some ideas but i don't know the event or method to trigger function on spell use in tf2 (yes this plugin adds charges to the book so i m really using this spells, not just spawning their effects) or eventually just on use of use item. (cuz the book is needed to use spells and we got 1 use slot anyway)
I m really thankfull for any help!
(Also sorry for my english. If anything isn't understandable just ask me i will try answer more simple.)
EDIT:
Well nvm. I just did it. If anyone looking for solve: Like i said i just needed the amount of spell's uses left so i used entity: GetEntProp(ent, Prop_Send, "m_iSpellCharges") and chained it to loop.
For Example:
Code:
public Action: PrintCharges(Handle:timer, any:hoge) {
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
new ent = -1;
ent = FindEntityByClassname(ent, "tf_weapon_spellbook");
sCharges = GetEntProp(ent, Prop_Send, "m_iSpellCharges");
SetHudTextParams(0.5, 0.5, 1.0, 255, 255, 255, 255);
ShowHudText(i, -1, "%s x%d", sSpell, sCharges);
}
}
if(sCharges <= 0)
{
cTimer2 = null;
return Plugin_Stop;
}
else
{
return Plugin_Continue;
}
}
Propably i will have more questions about my script in the future, hope i will get some answers ;)