ShowPlayerDIalog with string?
#1

Hello,
I'm trying to make a command 'myinfo' that will show a player his/her info. Right now i'm just trying to show the players IP. Is there anyway I can have a string in it for my "GetIp" stock?

Thanks!

pawn Код:
CMD:myinfo(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_MYINFO, DIALOG_STYLE_MSGBOX, "Player Info", "Your IP: %s", "Finished", "Cancel");
}


stock GetIp(playerid)
{
    new Ip[MAX_PLAYER_NAME];
    GetPlayerIp(playerid, Ip, sizeof(Ip));
    return Ip;
}
Reply
#2

Could you please explain? It would be greatly appreciated.
Reply
#3

(sorry for double posting)

So something like this?
pawn Код:
new string[100];
format(string,sizeof(string),"Your IP:",GetIp(playerid));
ShowPlayerDialog(playerid, DIALOG_MYINFO, DIALOG_STYLE_MSGBOX, "Player Info", "%s", "Finished", "Cancel");
Reply
#4

pawn Код:
new string[100];
format(string,sizeof(string),"Your IP: %s",GetIp(playerid));
ShowPlayerDialog(playerid, DIALOG_MYINFO, DIALOG_STYLE_MSGBOX, "Player Info", string, "Finished", "Cancel");
Reply
#5

be weary of 'string's size (100), you should only make that as big as there are possible letters in your text. In this example you should set it to 26, 9 for "Your IP: ", 16 for the largest amount of characters in an IP, and plus 1 for the null character that all strings have.
Reply
#6

Oh thanks a lot man! I only did 100 as an example, I calculate the size for the real one. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)