SA-MP Forums Archive
make a prefix for phone system? - 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)
+--- Thread: make a prefix for phone system? (/showthread.php?tid=643347)



make a prefix for phone system? - SetPlayerNameTag - 18.10.2017

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


Re: make a prefix for phone system? - Kane - 18.10.2017

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;




Re: make a prefix for phone system? - StrikerZ - 18.10.2017

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.


Re: make a prefix for phone system? - NaS - 18.10.2017

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)!