Send message from string with \n
#4

PHP код:
public OnPlayerText(playeridtext[])
{
    new 
count=0lastpos=0;
    while(
strfind(text"\n"truelastpos)!=-1)
    {
         
lastpos=strfind(text"\n"truelastpos);
         
count++;
    }
    if(
count>0)
    {
         new 
messages[16][256];
         
lastpos=0;
         
count=0;
         while(
strfind(text"\n"truelastpos)!=-1)
         {
              
format(messages[count], sizeof(messages[]), "%s"text[lastpos]);
              
lastpos=strfind(text"\n"truelastpos);
              
strdel(messages[count], lastpossizeof(messages[]));
              
count++;
         }
         for(new 
i=0i<sizeof (messages[]); i++)
         {
              new 
string[256], playername[MAX_PLAYER_NAME];
              
GetPlayerName(playeridplayernamesizeof(playername));
              
format(stringsizeof(string), "%s[%d]: %s"playernameplayeridmessages[i]);
              
SendClientMessageToAll(GetPlayerColor(playerid), string);
              return 
0;
         }
    }
    return 
1;

I didn't test it yet.
Reply


Messages In This Thread
Send message from string with \n - by Banditukas - 15.04.2015, 13:59
Re: Send message from string with \n - by ATGOggy - 15.04.2015, 14:11
Re: Send message from string with \n - by BroZeus - 15.04.2015, 14:29
Re: Send message from string with \n - by ATGOggy - 15.04.2015, 14:31
AW: Re: Send message from string with \n - by Nero_3D - 15.04.2015, 17:22
Re: Send message from string with \n - by Banditukas - 15.04.2015, 18:01
Re: Send message from string with \n - by Yashas - 15.04.2015, 18:34
Re: Send message from string with \n - by Banditukas - 15.04.2015, 18:42
Re: Send message from string with \n - by Azula - 15.04.2015, 18:51

Forum Jump:


Users browsing this thread: 5 Guest(s)