Quote:
Originally Posted by SchlumPF*
hi
i just want to know how i could get the current weapon of a player and save it as a variable. i hearded of the curweapon event but it doesnt work for me :S i need this for a kreedzplugin... i want to edit the top10 so just ppl who used a knife or usp can get a entry in top10
pls help me
|
use this:
Code:
#define MAXPLAYERS 32
// Array that holds number of the players last weapon
// (for changing the speed related to the current weapon)
new g_WeaponUsed[MAXPLAYERS+1]
public plugin_init()
{
register_event("CurWeapon", "Change_Wpn", "be")//Weapon changed....maybe adding "1=1"
}
// Called on player switches his weapon
public Change_Wpn(id)
{
new WeaponNum = read_data(2) // read and store the weaponID
new WeaponActive = read_data(1) // read the flag if weapon is active (user holds in his hand)
if ((WeaponNum != g_WeaponUsed[id]) && WeaponActive) // if weapon has changed and its the active weapon continue
{
g_WeaponUsed[id] = WeaponNum
// do something...
}
return PLUGIN_HANDLED
}
Btw.: you have to save the last weapon to avoid action on other CurWeapon events than changeweapon.
And here is a file with the weapon data...