A 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: A phone system (
/showthread.php?tid=253022)
A phone system -
Fallenmaster - 04.05.2011
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;
}
|
Re: A phone system -
alpha500delta - 04.05.2011
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.
Re: A phone system -
Fallenmaster - 04.05.2011
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.
Re: A phone system -
Cameltoe - 04.05.2011
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 ?
Re: A phone system -
Fallenmaster - 04.05.2011
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.
Re: A phone system -
Cameltoe - 04.05.2011
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
Re: A phone system -
alpha500delta - 04.05.2011
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.
Re: A phone system -
Cameltoe - 04.05.2011
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.