Raised This Month: $ Target: $400
 0% 

Help with native


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PawnBegg
Junior Member
Join Date: Apr 2022
Old 04-11-2022 , 15:18   Help with native
Reply With Quote #1

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 ?

Last edited by PawnBegg; 04-12-2022 at 05:04.
PawnBegg is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode