Hello,
I'm trying to make this tap into gameME api to get a players rank / position and display it in a HUD. It has a tag mismatch and its not working all. Not even displaying the HUD.
Maybe I'm taking the wrong approach or doing this totally wrong. I spent so much time editing this, can anyone help me out?
Thanks in advance.
Compiled warning:
PHP Code:
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\test32.sma(28) : warning 213: tag mismatch
// Header size: 460 bytes
// Code size: 756 bytes
// Data size: 712 bytes
// Stack/heap size: 16384 bytes
// Total requirements: 18312 bytes
//
// 1 Warning.
// Done.
//
// Compilation Time: 0.36 sec
// ----------------------------------------
My would be Frankenstein plugin.
PHP Code:
#include <amxmodx>
#include <gameme>
#include <csx>
#define QUERY_TYPE_ONCLIENTPUTINSERVER 1
const Float:REFRESH_RATE = 1.0;
public plugin_init( )
{
register_plugin( "GameME HUD Rank", "0.1", "no0ne" );
set_task( REFRESH_RATE, "QuerygameMEStatsCallback", .flags = "b" );
}
public cmdginfo(id) {
// We call the native to get a response from gameme
QueryGameMEStats("playerinfo", id, "QuerygameMEStatsCallback", QUERY_TYPE_ONCLIENTPUTINSERVER);
return PLUGIN_HANDLED;
}
public QuerygameMEStatsCallback(command, payload, client, &DataPack:datapack)
{
{
ResetPack(datapack)
new iRank = ReadPackCell(datapack)
SetPackPosition(datapack, 18)
new iSkill = ReadPackCell(datapack);
DestroyDataPack(datapack)
set_hudmessage( 0, 255, 0, -0.01, -0.2, .holdtime = ( REFRESH_RATE + 0.2 ), .fadeintime = 0.1, .fadeouttime = 0.1, .channel = 3 );
show_hudmessage( iRank, "Rank: %d / %d", "QuerygameMEStatsCallback: command -> %i, payload -> %i, client -> %N", command, payload, client, iRank, iSkill );
}
}
INC file for gameME api:
PHP Code:
#if defined _gameme_included_
#endinput
#endif
#define _gameme_included_
// raw message handling
#define RAW_MESSAGE_RANK 1
#define RAW_MESSAGE_PLACE 2
#define RAW_MESSAGE_KDEATH 3
#define RAW_MESSAGE_SESSION_DATA 4
#define RAW_MESSAGE_TOP10 5
#define RAW_MESSAGE_NEXT 6
// callbacks
#define RAW_MESSAGE_CALLBACK_PLAYER 101
#define RAW_MESSAGE_CALLBACK_TOP10 102
#define RAW_MESSAGE_CALLBACK_NEXT 103
// internal usage
#define RAW_MESSAGE_CALLBACK_INT_CLOSE 1000
#define RAW_MESSAGE_CALLBACK_INT_SPECTATOR 1001
forward onGameMEStatsRank(command, client, message_prefix[], &DataPack:datapack);
forward onGameMEStatsPublicCommand(command, client, message_prefix[], &DataPack:datapack);
forward onGameMEStatsTop10(command, client, message_prefix[], &DataPack:datapack);
forward onGameMEStatsNext(command, client, message_prefix[], &DataPack:datapack);
/**
* Query gameME Stats data from a client
*
* @param request Request type (only 'playerinfo' available)
* @param client Client index.
* @param func Callback function.
* @param payload Payload to distinct queries.
* @noreturn
*/
native QueryGameMEStats(request[], client, func[], payload = 0);
/**
* Query Top10 players from gameME Stats
*
* @param request Request type (currently only 'top10' available)
* @param client Client index.
* @param func Callback function.
* @param payload Payload to distinct queries.
* @noreturn
*/
native QueryGameMEStatsTop10(request[], client, func[], payload = 0);
/**
* Query next players from gameME Stats for s specified client
*
* @param request Request type (currently only 'next' available)
* @param client Client index.
* @param func Callback function.
* @param payload Payload to distinct queries.
* @noreturn
*/
native QueryGameMEStatsNext(request[], client, func[], payload = 0);
/**
* Query internal (preformatted) gameME Stats data
*
* @param request Request type.
* @param client Client index.
* @param func Callback function.
* @param payload Payload to distinct queries.
* @noreturn
*/
native QueryIntGameMEStats(request[], client, func[], payload = 0, limit = 0);