SA-MP Forums Archive
ShowPlayerDIalog with string? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ShowPlayerDIalog with string? (/showthread.php?tid=252221)



ShowPlayerDIalog with string? - Georgelopez1 - 30.04.2011

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;
}



Re: ShowPlayerDIalog with string? - Georgelopez1 - 30.04.2011

Could you please explain? It would be greatly appreciated.


Re: ShowPlayerDIalog with string? - Georgelopez1 - 30.04.2011

(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");



Re: ShowPlayerDIalog with string? - MadeMan - 30.04.2011

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");



Re: ShowPlayerDIalog with string? - Joe Staff - 30.04.2011

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.


Re: ShowPlayerDIalog with string? - Georgelopez1 - 30.04.2011

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