Use GetCmdArgInt(Ex) in base plugins (#1203)

This commit is contained in:
Asher Baker
2020-03-04 22:07:00 +00:00
committed by GitHub
parent 17440fc4be
commit d59edc5d0a
6 changed files with 24 additions and 64 deletions
+5 -12
View File
@@ -2,13 +2,6 @@
#include <cstrike>
#include <sdktools>
stock GET_ARG_INT( arg, maxSize=64 )
{
decl String:tempvar[maxSize];
GetCmdArg( arg, tempvar, maxSize );
return StringToInt( tempvar );
}
public OnPluginStart()
{
RegConsoleCmd( "get_mvps", get_mvps );
@@ -32,7 +25,7 @@ public Action:get_mvps( client, argc )
public Action:set_mvps( client, argc )
{
new count = GET_ARG_INT( 1 );
new count = GetCmdArgInt( 1 );
CS_SetMVPCount( client, count );
ReplyToCommand( client, "Set your MVP count to %d", count );
@@ -61,7 +54,7 @@ public Action:set_score( client, argc )
return Plugin_Handled;
}
new count = GET_ARG_INT( 1 );
new count = GetCmdArgInt( 1 );
CS_SetClientContributionScore( client, count );
ReplyToCommand( client, "Set your contribution score to %d", count );
@@ -90,7 +83,7 @@ public Action:set_assists( client, argc )
return Plugin_Handled;
}
new count = GET_ARG_INT( 1 );
new count = GetCmdArgInt( 1 );
CS_SetClientAssists( client, count );
ReplyToCommand( client, "Set your assist count to %d", count );
@@ -131,8 +124,8 @@ public Action:get_teamscore( client, argc )
public Action:set_teamscore( client, argc )
{
new team = GET_ARG_INT( 1 );
new score = GET_ARG_INT( 2 );
new team = GetCmdArgInt( 1 );
new score = GetCmdArgInt( 2 );
if ( team != CS_TEAM_T && team != CS_TEAM_CT )
{
+2 -4
View File
@@ -127,8 +127,7 @@ public Action:sm_setammo(client, argc)
new max = GetEntPropArraySize(target, proptype, "m_iAmmo");
GetCmdArg(1, buffer, sizeof(buffer));
new ammotype = StringToInt(buffer);
new ammotype = GetCmdArgInt(1);
if (ammotype >= max)
{
@@ -136,8 +135,7 @@ public Action:sm_setammo(client, argc)
return Plugin_Handled;
}
GetCmdArg(2, buffer, sizeof(buffer));
new amount = StringToInt(buffer);
new amount = GetCmdArgInt(2);
SetEntProp(target, proptype, "m_iAmmo", amount, _, ammotype);
+6 -20
View File
@@ -41,10 +41,7 @@ public Action:Command_Class(client, args)
public Action:Command_Remove(client, args)
{
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new one = StringToInt(text);
new one = GetCmdArgInt(1);
TF2_RemoveWeaponSlot(client, one);
@@ -64,10 +61,7 @@ public Action:Command_Remove(client, args)
public Action:Command_ChangeClass(client, args)
{
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new one = StringToInt(text);
new one = GetCmdArgInt(1);
PrintToChat(client, "Current class is :%i", TF2_GetPlayerClass(client));
@@ -104,13 +98,8 @@ public Action:Command_Disguise(client, args)
return Plugin_Handled;
}
decl String:text[10];
decl String:text2[10];
GetCmdArg(1, text, sizeof(text));
GetCmdArg(2, text2, sizeof(text2));
new one = StringToInt(text);
new two = StringToInt(text2);
new one = GetCmdArgInt(1);
new two = GetCmdArgInt(2);
TF2_DisguisePlayer(client, TFTeam:one, TFClassType:two);
@@ -201,10 +190,7 @@ public Action:Command_SetPowerPlay(client, args)
return Plugin_Handled;
}
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new bool:one = bool:StringToInt(text);
new bool:one = GetCmdArgInt(1) != 0;
TF2_SetPlayerPowerPlay(client, one);
@@ -245,4 +231,4 @@ public Action:Command_Frighten(client, args)
TF2_StunPlayer(client, 5.0, _, TF_STUNFLAGS_GHOSTSCARE);
return Plugin_Handled;
}
}