Hi, i have been trying to build a simple plugin for my server, mostly to play 4fun, that regenerates your SMG's Grenades when sm_ifrag is used, in HL2DM (it's also supposed to regenerate regular Grenades, but i wanted to try the SMG first).
At first, the plugin wouldn't compile because of a few errors, the initial code looked something like this:
Code:
#pragma semicolon 1
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "Infinite Grenades",
author = "Ventus",
description = "Infinite SMG secondary & Grenades",
version = PLUGIN_VERSION,
url="https://steamcommunity.com/id/ventusik"
}
public OnPluginStart ()
{
CreateConVar ("sm_ifrag_version", PLUGIN_VERSION, "Infinite Grenades", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
RegAdminCmd ("sm_ifrag", Command_SetIFRAG, ADMFLAG_CHEATS, "Give Infinite Grenades to the target - Usage: sm_ifrag");
AutoExecConfig(true, "InfiniteGrenades");
}
////////////
//Commands//
////////////
public Action:Command_SetIFRAG(client, args)
{
GivePlayerAmmo(client, 100,GetEntProp(GetPlayerWeaponSlot(client, 5),Prop_Send, "m_iPrimaryAmmoType"), false);
//native GivePlayerAmmo (client, 100, SMG1_Grenade, true);
//native GivePlayerAmmo (client, 100, grenade, true);
//GivePlayerAmmo(client, 123, GetEntProp(GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary), Prop_Send, "m_iPrimaryAmmoType"), true);
return Plugin_Handled;
}
Obviously, that didn't work, and i'm not sure how it was supposed to work
But anyway, i was able to compile doing this:
Code:
#pragma semicolon 1
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "Infinite Grenades",
author = "Ventus",
description = "Infinite SMG secondary & Grenades",
version = PLUGIN_VERSION,
url="https://steamcommunity.com/id/ventusik"
}
public OnPluginStart ()
{
CreateConVar ("sm_ifrag_version", PLUGIN_VERSION, "Infinite Grenades", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
RegAdminCmd ("sm_ifrag", Command_SetIFRAG, ADMFLAG_CHEATS, "Give Infinite Grenades to the target - Usage: sm_ifrag");
AutoExecConfig(true, "InfiniteGrenades");
}
////////////
//Commands//
////////////
public Action:Command_SetIFRAG(client, args)
{
GivePlayerAmmo(client, 100,GetPlayerWeaponSlot(client, 5), false);
//native GivePlayerAmmo (client, 100, SMG1_Grenade, true);
//native GivePlayerAmmo (client, 100, grenade, true);
//GivePlayerAmmo(client, 123, GetEntProp(GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary), Prop_Send, "m_iPrimaryAmmoType"), true);
return Plugin_Handled;
}
But the problem now is that the plugin won't work... I know SourceMod can execute it because typing sm_ifrag in the console won't bring an "unknown command" error...
So i'm out of clues now... How exactly is "GivePlayerAmmo()" supposed to work? I'm aware of the syntax, "GivePlayerAmmo(client, amount, ammotype, bool:suppressSound=false);", but nothing i have tried worked so far...
__________________