[Need Help]Chat Bubbles
#4

Simplest to use strtok
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[128], idx;
  cmd = strtok(cmdtext, idx);

  if(strcmp("/say", cmd, true)==0)
  {
    new tmp[128];
    new iText;
    tmp = strtok(cmdtext, idx);
    iText= strval(tmp);

    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /say [Text]");

    SetPlayerChatBubble(playerid, iText, 0xFF0000FF, 100.0, 10000);
    return 1;
  }
  return 0;
}

//Somewhere in your script
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Reply


Messages In This Thread
[Need Help]Chat Bubbles - by geerdinho8 - 23.02.2010, 20:58
Re: [Need Help]Chat Bubbles - by bajskorv123 - 23.02.2010, 21:08
Re: [Need Help]Chat Bubbles - by geerdinho8 - 23.02.2010, 21:10
Re: [Need Help]Chat Bubbles - by bajskorv123 - 23.02.2010, 21:16
Re: [Need Help]Chat Bubbles - by GhoulSlayeR - 23.02.2010, 21:17
Re: [Need Help]Chat Bubbles - by geerdinho8 - 24.02.2010, 08:58
Re: [Need Help]Chat Bubbles - by geerdinho8 - 24.02.2010, 09:15
Re: [Need Help]Chat Bubbles - by geerdinho8 - 24.02.2010, 10:56
Re: [Need Help]Chat Bubbles - by Thomas_Ahmey - 24.02.2010, 10:59

Forum Jump:


Users browsing this thread: 2 Guest(s)