make a prefix for phone system?
#1

Like /call 524-GOV or /call 245-256-242, it ignore the "-" and string
Reply
#2

It's simpler then you think.

For example:

PHP код:
CMD:call(playeridparams[])
{
     if(!
isnull(params) && !strcmp(params"524-GOV"true))
     {
           
doSomething();
           return 
1;
      }

      
//rest of your call cmd below it.
      
return 1;

Reply
#3

PHP код:
stock isNumeric(string[])
{
    for (new 
0strlen(string); ji++)
    {
        if (
string[i] > '9' || string[i] < '0') return 0;
    }
    return 
1;
}
CMD:call(playeridparams[])
{
      new 
number[40];
      if(
sscanf(params,"s",number)) return SendClientMessage(playerid, -1"USAGE: /call <number>");
      
      for(new 
0sizeof(number); i++)
      {
            if(!
strcmp(number"-") || !strcmp(numberisNumeric(number[i]))
            {
                
strdel(numberii+1);
            }
      }
      
// Your rest code
      
return 1;

Untested.
Reply
#4

Do you mean like using the T9 System properly (so if you call 555-NASE the number will be 5556273 (letters resolved to numbers, - removed))?


Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
...
Untested.
Maybe test it before posting, because that code will not work at all.

You put IsNumeric (which returns 1 or 0) as string argument into strcmp (why?), furthermore it will skip one '-' if there are two in a row. You must go back one index when deleting (well, you must stay where you are because Index 7 will become Index 6 when deleting Index 6, but the loop will continue to 7 anyway)!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)