Thread: [TF2] GunGame
View Single Post
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-05-2011 , 18:27   Re: [TF2] GunGame
Reply With Quote #2

Nice plugin! have a quick review.

Code:
// Check if the plugin is being run on the proper mod.
decl String:strModName[32]; GetGameFolderName(strModName, sizeof(strModName));
if (!StrEqual(strModName, "tf")) SetFailState("This plugin is only for Team Fortress 2.");
Should be in AskPluginLoad2 (and return APLRes_Failure rather than calling SetFailState etc.)

GetWeaponClass(...) and GunGameGiveWeapon(...) would be better as switches rather than if blocks.

A gamedata file is referenced but not included. The only function used (WeaponEquip) is actually provided by SDKTools anyway (EquipPlayerWeapon).

In CreateStockWeapon(...), you already specify OVERRIDE_ALL, just do:
Code:
Handle:CreateStockWeapon(String:strClassname[], iIndex)
{
    new Handle:hWeapon = TF2Items_CreateItem(OVERRIDE_ALL);
    TF2Items_SetClassname(hWeapon, strClassname);
    TF2Items_SetItemIndex(hWeapon, iIndex);
    TF2Items_SetQuality(hWeapon, 0);
    TF2Items_SetNumAttributes(hWeapon, 0);
    
    return hWeapon;
}
You should probably set the level as well by the way.

Also, gungame_version is already used by another plugin, you need to have a unique cvar for approval.
__________________

Last edited by asherkin; 07-05-2011 at 18:32.
asherkin is offline