View Single Post
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 12-21-2012 , 05:34   Re: [TF2 + TF2Items + TF2Items GiveWeapon] How to make a custom gamemode
Reply With Quote #5

Quote:
Originally Posted by Bitl View Post
Quote:
Originally Posted by Leonardo View Post
as longer as TF2Items GiveWeapon uses TF2ItemsInfo,
there's already TF2ItemSlot enum
so you have to check for it
Code:
#if !defined _tf2itemsinfo_included
new TF2ItemSlot = 8;
#endif
you also can crate weapon with TF2Items GiveWeapon' natives
Code:
public OnAllPluginsLoaded()
{
    TF2Items_CreateWeapon( 9990, "tf_weapon_syringegun_medic", 527, 0, 9, 10, "280 ; 1 ; 6 ; 1.45 ; 31 ; 3 ; 32 ; 1 ; 2 ; 1.4 ; 125 ; -10", 300, _, true );
}
also someone told me do not use function/variable names longer than 32 chars.

so plugin should look like:
PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <tf2_stocks>

#define REQUIRE_EXTENSIONS
#define AUTOLOAD_EXTENSIONS
#include <tf2items>

#undef REQUIRE_PLUGIN
#tryinclude <tf2itemsinfo>

#define REQUIRE_PLUGIN
#include <tf2items_giveweapon>

#define MY_WEAPON_ID 9090

#if !defined _tf2itemsinfo_included
new TF2ItemSlot 8;
#endif

public Plugin:myinfo =
{
    
name "[TF2] Pyro Battle",
    
author "You",
    
description "A gamemode where pyros fight each others.",
    
version "1.1",
    
url "http://forums.alliedmods.net/showthread.php?t=203225"
};

public 
OnPluginStart()
{
    
HookEvent"post_inventory_application"OnHookedEvent );
    
HookEvent"player_spawn"OnHookedEvent );
}

public 
OnAllPluginsLoaded()
{
    
TF2Items_CreateWeaponMY_WEAPON_ID"tf_weapon_syringegun_medic"5270910"280 ; 1 ; 6 ; 1.45 ; 31 ; 3 ; 32 ; 1 ; 2 ; 1.4 ; 125 ; -10"300_true );
}

public 
OnPostInventoryApplicationAndPlayerSpawnHandle:hEvent, const String:strEventName[], bool:bDontBroadcast )
{
    new 
iClient GetClientOfUserIdGetEventInthEvent"userid" ) )
    if( 
iClient <= || iClient MaxClients || !IsClientInGame(iClient/*|| !IsPlayerAlive(iClient)*/ )
        return;
    
    for( new 
iSlot 0iSlot _:TF2ItemSlotiSlot++ )
        
TF2_RemoveWeaponSlotiClientiSlot );
    
    
TF2_SetPlayerClassiClientTFClass_Pyro_true );
    
    
TF2Items_GiveWeaponiClientMY_WEAPON_ID );

EDIT:
oh
any reason why it's a tf_weapon_syringegun_medic with item ID #527 (widowmaker)?
It looks cool in the pyro's viewmodel.
why don't just use tf_weapon_shotgun_pyro then?
__________________
Leonardo is offline