how to make a payphone - 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: how to make a payphone (
/showthread.php?tid=627283)
how to make a payphone -
Wahyu33 - 26.01.2017
hallo all anyone can help me make a payphone
Re: how to make a payphone -
Sew_Sumi - 26.01.2017
This isn't what this section is for.
https://sampforum.blast.hk/showthread.php?tid=447813
Re: how to make a payphone -
Wahyu33 - 26.01.2017
ohh ok thanks for the info
Re: how to make a payphone -
Sew_Sumi - 26.01.2017
Just so you know, what this section is for, it is for if you have code that is giving you problems.
Something that you've made that should work, but seemingly doesn't, or for clarification on certain functions usages.
If you are new to scripting, I'd suggest you look at ZCMD, sscanf, and the streamer plugin as those are the main things people are using for basic commands, gamemodes, and mapping.
There are various tutorials around the forum.
With this situation though you'd be looking at IsPlayerInRangeOfPoint, and using that to check where you are against a list of all the various payphone areas.
https://sampforum.blast.hk/showthread.php?tid=627280
Just an example of something someone asked earlier that was answered in an adequate manner.
Re: how to make a payphone -
SuperTramp - 26.01.2017
+Rep!
Quote:
//------------------------------PAYPHONES------------------------------------------------//
new Floatay_phone[2][3] = {
{1807.4861,-1599.31,13.5469}, // payphone 1
{1710.9800,-1604.9263,13.5469}, // payphone 2
};
stock NearestPayphone(playerid)
{
for(new i = 0; i < sizeof(pay_phone); i ++)
{
if(IsPlayerInRangeOfPoint(playerid,25.0,pay_phone[i][0],pay_phone[i][1],pay_phone[i][2]))
{
return i;
}
}
return -1;
}
COMMANDayphone(playerid,params[])
{
new pphone = NearestPayphone(playerid);
if(pphone > 0)
{
new idx = 0;
new tmp[64];
tmp = strtok(params,idx);
if(!strlen(tmp)) { SendClientMessageA(playerid,COLOR_LIGHTRED,"USAGE: /payphone [phone number]"); return 1; }
new number = strval(tmp);
if(number > 0)
{
BeginCall(playerid,number);
return 1;
}
else
{
SendErrorMsg(playerid,"Invalid phone number.");
return 1;
}
}
else
{
SendErrorMsg(playerid,"You are not near a working Payphone"); // gives me this error when im
return 1;
}
}
|
Re: how to make a payphone -
Sew_Sumi - 26.01.2017
Quote:
Originally Posted by SuperTramp
+Rep!
|
Copy-pasting isn't a good way to teach. That code will produce errors.
Namely SendErrorMessage isn't defined, strtok will need to be present and he has to be using ZCMD to make it even work at all.
And BeginCall is missing as well.