Not tested.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
//#include <sdkhooks>
#define PLUGIN_AUTHOR "Arkarr"
#define PLUGIN_VERSION "1.0"
public Plugin myinfo =
{
name = "[CSS/CSGO] Prop cash",
author = PLUGIN_AUTHOR,
description = "Spawn prop wich give cash upon touch",
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net"
};
public void OnPluginStart()
{
EngineVersion game = GetEngineVersion();
if(game != Engine_CSGO && game != Engine_CSS)
SetFailState("This plugin is for CSGO/CSS only.");
RegConsoleCmd("sm_ammo", CMD_Ammo, "Set the number of ammo of the specified weapon.");
RegConsoleCmd("sm_drop", CMD_Drop, "Force to drop the specified weapon.");
LoadTranslations("common.phrases");
}
public Action CMD_Ammo(int client, int args)
{
if(args != 3)
{
ReplyToCommand(client, "Usage : sm_ammo <userid> <weapon slot> <ammo>");
return Plugin_Handled;
}
char arg1[45];
char arg2[45];
char arg3[45];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(3, arg3, sizeof(arg3));
int target = FindTarget(client, arg1);
if(target == -1)
return Plugin_Handled;
int weaponSlot = StringToInt(arg2);
int weapon = GetPlayerWeaponSlot(target, weaponSlot);
if(weapon == -1)
{
ReplyToCommand(client, "%N doesn't have a weapon in slot %i", weaponSlot);
return Plugin_Handled;
}
int ammo = StringToInt(arg3);
SetEntProp(weapon, Prop_Data, "m_iClip1", ammo);
ReplyToCommand(client, "%N got %i ammo for his weapon slot %i", target, ammo, weaponSlot);
return Plugin_Handled;
}
public Action CMD_Drop(int client, int args)
{
if(args != 2)
{
ReplyToCommand(client, "Usage : sm_drop <userid> <weapon slot>");
return Plugin_Handled;
}
char arg1[45];
char arg2[45];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
int target = FindTarget(client, arg1);
if(target == -1)
return Plugin_Handled;
int weaponSlot = StringToInt(arg2);
int weapon = GetPlayerWeaponSlot(target, weaponSlot);
if(weapon == -1)
{
ReplyToCommand(client, "%N doesn't have a weapon in slot %i", target, weaponSlot);
return Plugin_Handled;
}
CS_DropWeapon(target, weapon, true, true);
ReplyToCommand(client, "%N dropped his weapon !", target);
return Plugin_Handled;
}
__________________