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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 64 deletions

View File

@ -237,9 +237,7 @@ public Action Command_Blind(int client, int args)
int amount = 0;
if (args > 1)
{
char arg2[20];
GetCmdArg(2, arg2, sizeof(arg2));
if (StringToIntEx(arg2, amount) == 0)
if (!GetCmdArgIntEx(2, amount))
{
ReplyToCommand(client, "[SM] %t", "Invalid Amount");
return Plugin_Handled;

View File

@ -492,16 +492,11 @@ public Action Command_Freeze(int client, int args)
int seconds = g_Cvar_FreezeDuration.IntValue;
if (args > 1)
{
char time[20];
GetCmdArg(2, time, sizeof(time));
if (StringToIntEx(time, seconds) == 0)
if (args > 1 && !GetCmdArgIntEx(2, seconds))
{
ReplyToCommand(client, "[SM] %t", "Invalid Amount");
return Plugin_Handled;
}
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;

View File

@ -609,16 +609,11 @@ public Action Command_AddGroup(int client, int args)
}
int immunity;
if (args >= 3)
{
char arg3[32];
GetCmdArg(3, arg3, sizeof(arg3));
if (!StringToIntEx(arg3, immunity))
if (args >= 3 && !GetCmdArgIntEx(3, immunity))
{
ReplyToCommand(client, "[SM] %t", "Invalid immunity");
return Plugin_Handled;
}
}
Database db = Connect();
if (db == null)
@ -772,16 +767,11 @@ public Action Command_AddAdmin(int client, int args)
}
int immunity;
if (args >= 5)
{
char arg5[32];
GetCmdArg(5, arg5, sizeof(arg5));
if (!StringToIntEx(arg5, immunity))
if (args >= 5 && !GetCmdArgIntEx(5, immunity))
{
ReplyToCommand(client, "[SM] %t", "Invalid immunity");
return Plugin_Handled;
}
}
char identity[65];
char safe_identity[140];

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 )
{

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);

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);