A phone system
#1

Hey all,

Recently I've been working on a small script I'm planning to expand. Though I'm still an amature when it comes down onto scripting with Pawn. I'd like someone to explain me how to make a phone system, I already made a small beginning.

Quote:

if (strcmp("/phone", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /phone call | sms | number | NOT FINISHED");
return 1;
}
if (strcmp("/phone call", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /phone call <number> | NOT FINISHED");
return 1;
}
if (strcmp("/phone sms", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /phone sms <number> <text> | NOT FINISHED");
return 1;
}
if (strcmp("/phone number", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Your number is 4431.");
return 1;
}

Reply
#2

you might want to try sscanf, as this will not work, or cause epic lagg when you have more numbers.

pawn Код:
new pID; //Making variable for other playerid
if(sscanf(params, "d", pID, params)) return SendClientMessage(playerid, COLOR, "Usage: /call [number]"); //If the player just typed "/call"
else if(params <= 1111 || params >= 9999) return 1;//If the phone number was invalid.
SendClientMessage(pID, COLOR, "Hey, someone calls you...");//Sending message to that player that he is being called
You should also run a check to see if the phone number actually exists, use the wiki for that. Also you should use ZCMD with this code. Good luck!



Also:
Код:
if (strcmp("/phone number", cmdtext, true, 10) == 0)
You're saying that you're command is 10 characters long, but it's actually 13(?). So you should fix that too.
Reply
#3

Thanks, but how do I assign phone-numbers to players? Is there a possibility to do it randomly?

I slightly think that this is too complicated for me. I just started scripting.
Reply
#4

Quote:
Originally Posted by Fallenmaster
Посмотреть сообщение
Thanks, but how do I assign phone-numbers to players? Is there a possibility to do it randomly?

I slightly think that this is too complicated for me. I just started scripting.
Do you use ini ? or mysql ?
Reply
#5

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Do you use ini ? or mysql ?
I actually have no knowledge about that at all.. I simply click on some functions in the menu on my right and start making some stuff up. I haven't followed any tutorial since I think that some of them are simply bad. If I could get my hands on a good tutorial I'd surely deep myself into this whole Pawn thing.
Reply
#6

https://sampwiki.blast.hk/ Is probably the best resource at this time, look at the right side, there's an column named "scripting" read everything related to that, once you get the idea, get back here and post some feedback on your progress. Good luck
Reply
#7

You can also check RP scripts (Please, do not try Godfather) to see their phone system, it might help you alot.
To assign phone numbers you can use the Random function.
Reply
#8

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
You can also check RP scripts (Please, do not try Godfather) to see their phone system, it might help you alot.
To assign phone numbers you can use the Random function.
I wouldn't recommend reading other scripts unless you really know how they operate, as they may contain bugs and faulty scriptings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)