need help with my gate, - 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: need help with my gate, (
/showthread.php?tid=208506)
need help with my gate, -
zimon_5 - 08.01.2011
I was trying to make a gate that opens when I come to it at LSPD, but some thing is wrong with my script
and I don't know what, and now does I hope for help, I'm new to scripts, and my game mode is downloaded from samp forum,
Код:
#include <a_samp>
stock IsPlayerInRangeOfPoint(playerid, Float:radius, Float:X, Float:Y, Float:Z)
{
new Float:px,Float:py,Float:pz;
GetPlayerPos(playerid,px,py,pz);
return ( ( ((px-X)*(px-X))+((py-Y)*(py-Y))+((pz-Z)*(pz-Z)) ) >= radius*radius );
}new mygate;
mygate = CreateObject(2920, 1544.7008056641, -1630.8284912109, 13.229135513306, 271.25009155273, 180, 180);
SetTimer("CheckGate",2000,true);
forward CheckGate();
public CheckGate()
{
new mygate_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,1544.7008056641,-1630.8284912109,13.229135513306))mygate_status=1;
}
if(mygate_status)MoveObject(mygate, 1544.6550292969, -1630.546875, 13.379133224487,1000);
else MoveObject(mygate, 1544.7008056641, -1630.8284912109, 13.229135513306, 1000);
}
that was my script
Код:
CreateObject(2920, 1544.7008056641, -1630.8284912109, 13.229135513306, 271.25009155273, 180, 180);
here is the gate closed
Код:
CreateObject(2920, 1544.6550292969, -1630.546875, 13.379133224487, 0, 0, 0);
and here is a pic of the errors I think
http://sphotos.ak.fbcdn.net/hphotos-..._3210928_n.jpg
I used this to help me
https://sampwiki.blast.hk/wiki/Automatic_Gates
Re: need help with my gate, -
Joe Staff - 08.01.2011
Remove IsPlayerInRangeOfPoint completely, it already exists
Re: need help with my gate, -
Drowzz - 08.01.2011
roflol indeed, it's default by sa-mp