View Single Post
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 11-08-2016 , 04:55   Re: CS:GO GiveNamedItem Econ
Reply With Quote #132

Quote:
Originally Posted by metal_upa View Post
This extension only has 1 feature.

Code:
/* Called before createing a econ item view
 * Return Plugin_Continue to create a econitem view based on the players  loadout, anything else to bypass it and use the original GiveNameItem  paramaters.
 *
 * @param client        Client the item is being given to.
 * @param iDefIndex        The definition index of the item.
 * @param iTeam            Clients team
 * @param iLoadoutSlot    Loadout slot for the given item. If -1 the  item is not for the clients team. (ak47 for ct's for example)
 * @param szItem        Item string passed to GiveNameItem
 *
*/
forward Action:GNIEcon_OnGiveNamedItem(client, iDefIndex, iTeam, iLoadoutSlot, const String:szItem[]);
PHP Code:
#define PLUGIN_AUTHOR "metal_upa"
#define PLUGIN_VERSION "0.0.1"

#include <sourcemod>
#include <gniecon>

public Plugin:myinfo 
{
    
name "GiveNameItemFix",
    
author PLUGIN_AUTHOR,
    
description "Fix GiveNameItem in CSGO",
    
version PLUGIN_VERSION,
    
url "www.google.com"
};

public 
Action:GNIEcon_OnGiveNamedItem(clientiDefIndexiTeamiLoadoutSlot, const String:szItem[])
{
    return 
Plugin_Continue;

return Plugin_Continue will give you a weapon with a correct weapon skin.
The extension will do that by default. That forward is used to block giving skinned weapons of the opposite team by returning Plugin_Handled under whatever conditions you like. So you can use the engine's logic on certain clients.
Usually you just want to load it and forget it.
__________________
Peace-Maker is offline