sm-plugins/sentry_mod.sp

123 lines
2.5 KiB
SourcePawn

//* Plugin Template generated by Pawn Studio */
#include <sourcemod>
#include <sdktools_functions>
public Plugin:myinfo =
{
name = "Sentry Mod",
author = "Chefe",
description = "lw",
version = "1.0",
url = "www.the-bos.de"
}
public OnPluginStart()
{
RegAdminCmd("sm_ssa", Command_SetSentryAmmo, ADMFLAG_CHEATS, "Set prop ammo of the sentry your looking at");
RegAdminCmd("sm_ssr", Command_SetSentryRockets, ADMFLAG_CHEATS, "Set prop rocketammo of the sentry your looking at");
RegAdminCmd("sm_ssl", Command_SetSentryLevel, ADMFLAG_CHEATS, "Set prop lvl of the sentry your looking at");
}
public Action:Command_SetSentryAmmo(client, args)
{
if (args < 1)
{
PrintToConsole(client, "Usage: sm_ssa <ammo>")
return Plugin_Handled
}
new index = GetClientAimTarget(client, false);
new String:arg1[150];
GetCmdArg(1, arg1, sizeof(arg1));
new ammo = StringToInt(arg1);
SetSentryAmmo(index, ammo);
ReplyToCommand(client, "[SM] Ammo of Sentry %i was set on %i", index, ammo);
return Plugin_Handled;
}
public Action:Command_SetSentryRockets(client, args)
{
if (args < 1)
{
PrintToConsole(client, "Usage: sm_ssr <rockets>")
return Plugin_Handled
}
new index = GetClientAimTarget(client, false);
new String:arg1[150];
GetCmdArg(1, arg1, sizeof(arg1));
new ammo = StringToInt(arg1);
new level = GetSentryLevel(index)
if (level == 3)
{
SetSentryRockets(index, ammo);
ReplyToCommand(client, "[SM] Rockets of Sentry %i was set on %i", index, ammo);
}
else
{
ReplyToCommand(client, "[SM] Sentry %i is not on lvl 3!", index);
}
return Plugin_Handled;
}
public Action:Command_SetSentryLevel(client, args)
{
if (args < 1)
{
PrintToConsole(client, "Usage: sm_ssl <lvl>")
return Plugin_Handled
}
new index = GetClientAimTarget(client, false);
new String:arg1[150];
GetCmdArg(1, arg1, sizeof(arg1));
new lvl = StringToInt(arg1);
SetSentryLevel(index, lvl);
ReplyToCommand(client, "[SM] Sentry %i was set on level %i", index, lvl);
return Plugin_Handled;
}
SetSentryAmmo(index, ammo)
{
SetEntProp(index, Prop_Send, "m_iAmmoShells", ammo);
}
SetSentryRockets(index, rockets)
{
SetEntProp(index, Prop_Send, "m_iAmmoRockets", rockets);
}
SetSentryLevel(index, level)
{
SetEntProp(index, Prop_Send, "m_iUpgradeLevel", level);
}
GetSentryAmmo(index)
{
new ammo = GetEntProp(index, Prop_Send, "m_iAmmoShells");
return ammo;
}
GetSentryRockets(index)
{
new rockets = GetEntProp(index, Prop_Send, "m_iAmmoRockets");
return rockets;
}
GetSentryLevel(index)
{
new lvl = GetEntProp(index, Prop_Send, "m_iUpgradeLevel");
return lvl;
}