Hello boys and girls, can some one teach me with natives, i need some help.
in .inc file i have native like this ->
Code:
/**
* Returns a player's Rank ID. Set Rang name in output.
*
* @param id Player index.
* @param output Output buffer for rang name.
* @param len Max length of a output buffer.
*
* @return Player Rank ID. -1 on error.
*/
native csgor_get_user_rank(id, output[], len);
.sma
Code:
public native_get_user_rank(iPluginID, iParamNum)
{
#if defined DEBUG
log_to_file("csgor_debug_logs.log", "native_get_user_rank()")
#endif
if (iParamNum != 3)
{
log_error(AMX_ERR_NATIVE, "%s Invalid param num ! Valid: (PlayerID, Output, Len)", CSGO_TAG);
return -1;
}
new id = get_param(1);
if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "%s Player is not connected (%d)", CSGO_TAG, id);
return -1;
}
new rank = g_iUserRank[id];
new szRank[32];
ArrayGetString(g_aRankName, rank, szRank, charsmax(szRank));
set_string(2, szRank, get_param(3));
return rank;
}
how to call it in another .sma file and get rank name ?
Thanks you.
UPDATE........
i Did like this but even if my rank for ex is Silver IV i got message like this [RANK] "NAME" has connected and he is "SILVER I" rank.
Code:
new szRank[32];
csgor_get_user_rank(id, szRank, charsmax(szRank));
client_print_color(0, print_chat, "^4[RANK ^3%s ^1has connected, and he is%s.", szRank);
What i did wrong? why in every connection print only SILVER I ?