/sms help
#1

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?
Reply
#2

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;
}
Reply
#3

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 2 Guest(s)