#1

Hello.
When I enter the following code in these params:
Код:
/amsg 0 No problem.\nIt's a bug.\nYou can report it on www.example.com/report-bugs
// CMD: /amsg [playerid] [text]
I want see this dialog:

but I see this dialog:



My code:
PHP код:
dcmd_amsg(playerid,params[])
{
    if(
AccInfo[playerid][Level] >= && AccInfo[playerid][LoggedIn] == 1)
    {
        new 
text[256], id;
        new 
str[128];
        if(
sscanf(params"us[256]",id,text)) return GameTextForPlayer(playerid,"~g~/amsg ~w~(id) (text)",3000,3);
        
          if(
AccInfo[id][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return GameTextForPlayer(playerid,"~r~~h~ERROR: You cannot use this command on this admin",6000,3);
        if(!
IsPlayerConnected(id)) return GameTextForPlayer(playerid,"~r~player is not connected",4000,3);
        
        
format(str,sizeof(str),"{FFFFFF}%s",text);
        
ShowPlayerDialog(id,13003,DIALOG_STYLE_MSGBOX,"{00FF00}Admins Message",str,"Close","");
    }
    return 
1;

Reply
#2

The new line '\n' is one character. The problem is that it takes your input as two characters separated.
You need a loop and check if current index is equal to '\\' and index+1 is equal to 'n' character. Then replace index with ' ' and index+1 with '\n' character.
Reply
#3

string replace "\\n" with "\n"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)