View Single Post
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-10-2014 , 10:50   Re: [REQ-TF2] Give/Equip player flare gun
Reply With Quote #8

Quote:
Originally Posted by MasterOfTheXP View Post
Sorry; here's another version that works. Tested this time around
PHP Code:
#include <tf2_stocks>
#include <tf2items>
#include <tf2items_giveweapon>

public TF2Items_OnGiveNamedItem_Post(clientString:classname[], itemDefinitionIndexitemLevelitemQualityentityIndex)
{
    if (
StrEqual(classname"tf_weapon_flaregun"false) || StrEqual(classname"tf_weapon_flaregun_revenge"false))
        return; 
// It's a flare gun already
    
new Handle:data;
    
CreateDataTimer(0.0Timer_CheckFlareGundataTIMER_FLAG_NO_MAPCHANGE);
    
WritePackCell(dataGetClientUserId(client));
    
WritePackCell(dataEntIndexToEntRef(entityIndex));
    
ResetPack(data);
}

public 
Action:Timer_CheckFlareGun(Handle:timerHandle:data)
{
    new 
client GetClientOfUserId(ReadPackCell(data));
    if (!
client) return;
    new 
entityIndex EntRefToEntIndex(ReadPackCell(data));
    if (
entityIndex <= MaxClients) return;
    
    if (
entityIndex != GetPlayerWeaponSlot(client1)) return;
    
TF2Items_GiveWeapon(client39);

You could just do point_servercommand, but then you'd be overriding players' own Flare Guns, and ensuring that they'd be invisible 100% of the time.
Unless he uses Attachables
__________________
...
Oshizu is offline