function in format
#1

Hi, does anyone know how I can use this function in this format?


Код:
format(string, sizeof(string), "Country: %s",GetPlayerCachedCountryName(..));
SendClientMessage(playerid, -1, string);
...


// cntr_Country[45],
stock GetPlayerCachedCountryName(playerid, output[], len = sizeof(output))
{
	if(!IsPlayerConnected(playerid))
		return 0;

	output[0] = EOS;
	strcat(output, PlayerCountryData[playerid][cntr_Country], len);

	return 1;
}
Reply
#2

pawn Код:
new string[150];
GetPlayerCachedCountryName(playerid, string);

strins(string, "Country: ", 0);
Reply
#3

pawn Код:
SendClientMessage(playerid, -1, GetPlayerCachedCountryName(playerid));

GetPlayerCachedCountryName(playerid)
{
    new str[55] = "Unknown";
    if(!IsPlayerConnected(playerid)) return str;

    str = "Country: ";
    strcat(str, PlayerCountryData[playerid][cntr_Country]);

    return str;
}
Reply
#4

You can return string in stock
PHP код:
stock GetPlayerCachedCountryName(playerid)
{
    new 
output[35] = "Unknown";
    if(
IsPlayerConnected(playerid))
    {
        
output[0] = EOS;
        
strcat(outputPlayerCountryData[playerid][cntr_Country], 35);
    }
    return 
output;

PHP код:
format(stringsizeof(string), "Country: %s",GetPlayerCachedCountryName(playerid)); 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)