SA-MP Forums Archive
/sms help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /sms help (/showthread.php?tid=153211)



/sms help - DX7 - 07.06.2010

I've recently changed a phone system so phone numbers save in this format: 1-threerandomnumbers-fourrandomnumbers (example: 1-583-2974)

Due to that, the phone numbers save & load as strings however i'm not sure how I can implement this 'check' to /call or /sms, to see if they entered somebody's phone number. But of course it has to be a string and it can't be strval right?


Re: /sms help - Antonio [G-RP] - 07.06.2010

What you could do, is save as 3 variables, if 1 is always same then just save the last 2..

like

pawn Код:
PlayerInfo[playerid][pNumber1]
pawn Код:
PlayerInfo[playerid][pNumber2]
then if you were to do a command like this, have it show the - in between..

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/checknumber", true) == 0) {
    new string[256];
    format(string, sizeof(string), "Your phone number is 1-%d-%d", PlayerInfo[playerid][pNumber1], PlayerInfo[playerid][pNumber2]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
  }
  return 1;
}



Re: /sms help - DX7 - 07.06.2010

Thanks for replying but I believe you misunderstood my post, though that's my fault.

basically in the /sms, it's /sms <number> <message>

now, the SMS script usually checks each player and see's if their aiCell is the same as what I enter in <number>. The problem is <number> is a string due to the format I want, with the dashes, but i'm not sure how to check the string if you see what I mean


Re: /sms help - Antonio [G-RP] - 08.06.2010

Hmm maybe strfind or some function can find the - and when you enter the number, replace the '-' with a '' (by that i mean replace with nothing)