Posts: 51
Threads: 11
Joined: Dec 2016
Reputation:
0
hallo all anyone can help me make a payphone
Posts: 6,242
Threads: 8
Joined: Jun 2008
Posts: 51
Threads: 11
Joined: Dec 2016
Reputation:
0
ohh ok thanks for the info
Posts: 6,242
Threads: 8
Joined: Jun 2008
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.
Posts: 63
Threads: 9
Joined: Aug 2016
+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;
}
}
|
Posts: 6,242
Threads: 8
Joined: Jun 2008
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.