Added natives to CStrike ext to access assists/score in CSGO (bug 5525, r=asherkin).

This commit is contained in:
Nicholas Hastings
2012-12-15 14:36:52 -05:00
parent c0b91dd107
commit ba2915ce4e
5 changed files with 326 additions and 76 deletions
+45 -3
View File
@@ -285,8 +285,8 @@ native CS_SetTeamScore(team, value);
/**
* Gets a client's mvp count
* @param client Client index to set mvp count for.
* @return Returns the clients internal MVP count.
* @param client Client index to get mvp count of.
* @return Returns the client's internal MVP count.
*
* @error Invalid client.
*/
@@ -295,13 +295,51 @@ native CS_GetMVPCount(client);
/**
* Sets a client's mvp count
* @param client Client index to set mvp count for.
* @param value Value to set clients mvp count as.
* @param value Value to set client's mvp count as.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetMVPCount(client, value);
/**
* Gets a client's contribution score (CS:GO only)
* @param client Client index to get score of.
* @return Returns the client's score.
*
* @error Invalid client.
*/
native CS_GetClientContributionScore(client);
/**
* Sets a client's contribution score (CS:GO only)
* @param client Client index to set score for.
* @param value Value to set client's score as.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetClientContributionScore(client, value);
/**
* Gets a client's assists (CS:GO only)
* @param client Client index to get assists of.
* @return Returns the client's assists.
*
* @error Invalid client.
*/
native CS_GetClientAssists(client);
/**
* Sets a client's assists (CS:GO only)
* @param client Client index to set assists for.
* @param value Value to set client's assists as.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetClientAssists(client, value);
/**
* Gets a weaponID from a alias
* @param alias Weapon alias to attempt to get an id for.
@@ -350,6 +388,10 @@ public __ext_cstrike_SetNTVOptional()
MarkNativeAsOptional("CS_SetTeamScore");
MarkNativeAsOptional("CS_GetMVPCount");
MarkNativeAsOptional("CS_SetMVPCount");
MarkNativeAsOptional("CS_GetClientContributionScore");
MarkNativeAsOptional("CS_SetClientContributionScore");
MarkNativeAsOptional("CS_GetClientAssists");
MarkNativeAsOptional("CS_SetClientAssists");
MarkNativeAsOptional("CS_AliasToWeaponID");
}
#endif
+94
View File
@@ -0,0 +1,94 @@
#include <sourcemod>
#include <cstrike>
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 );
RegConsoleCmd( "set_mvps", set_mvps );
RegConsoleCmd( "get_score", get_score );
RegConsoleCmd( "set_score", set_score );
RegConsoleCmd( "get_assists", get_assists );
RegConsoleCmd( "set_assists", set_assists );
}
public Action:get_mvps( client, argc )
{
ReplyToCommand( client, "Your MVP count is %d", CS_GetMVPCount( client ) );
return Plugin_Handled;
}
public Action:set_mvps( client, argc )
{
new count = GET_ARG_INT( 1 );
CS_SetMVPCount( client, count );
ReplyToCommand( client, "Set your MVP count to %d", count );
return Plugin_Handled;
}
public Action:get_score( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
}
ReplyToCommand( client, "Your contribution score is %d", CS_GetClientContributionScore( client ) );
return Plugin_Handled;
}
public Action:set_score( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
}
new count = GET_ARG_INT( 1 );
CS_SetClientContributionScore( client, count );
ReplyToCommand( client, "Set your contribution score to %d", count );
return Plugin_Handled;
}
public Action:get_assists( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
}
ReplyToCommand( client, "Your assist count is %d", CS_GetClientAssists( client ) );
return Plugin_Handled;
}
public Action:set_assists( client, argc )
{
if( GuessSDKVersion() != SOURCE_SDK_CSGO )
{
ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled;
}
new count = GET_ARG_INT( 1 );
CS_SetClientAssists( client, count );
ReplyToCommand( client, "Set your assist count to %d", count );
return Plugin_Handled;
}