View Single Post
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 01-09-2014 , 22:52   Re: [REQ-TF2] Give/Equip player flare gun
Reply With Quote #7

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.
Attached Files
File Type: smx flareguns.smx (3.8 KB, 196 views)
File Type: sp Get Plugin or Get Source (flareguns.sp - 217 views - 922 Bytes)
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)

Last edited by MasterOfTheXP; 01-09-2014 at 22:53.
MasterOfTheXP is offline