How to return string.
#1

Hi there,

So i have this problem, I don't know how to return string.
I want this
pawn Код:
format(String, sizeof(String), "Rank name is: %s", GetRankName(FactionID, Rank));
but i don't get it how to return a string
Reply
#2

What do you mean by "returning" it?
Reply
#3

If you mean sending the string to someone, try SendClientMessage().
Reply
#4

no i don't want to send string to player as message, i want to return text with function
Reply
#5

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
no i don't want to send string to player as message, i want to return text with function
It depends on the function, try doing something like:

pawn Код:
return String;
Reply
#6

pawn Код:
return SendClientMessage(playerid, color, String);
? If you don't have 'playerid' forwarded you won't be able to do that...

Can you show us your full code, so we could maybe make something?
Reply
#7

I have done this for my gamemode, you can easily modify it for your needs;

pawn Код:
stock RankName(playerid)
{
    new rankn[16],groupid;
    groupid = pData[playerid][pGroup];
    new rank = pData[playerid][pRank];
    switch(rank)
    {
        case 1: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank1]);
        case 2: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank2]);
        case 3: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank3]);
        case 4: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank4]);
        case 5: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank5]);
        case 6: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank6]);
        case 7: format(rankn,sizeof(rankn),"%s",gData[groupid][gRank7]);
    }
    return rankn;
}
Reply
#8

yey i made it thanks every one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)