SA-MP Forums Archive
what isn't good in this code? - 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: what isn't good in this code? (/showthread.php?tid=369452)



what isn't good in this code? - kesem140599 - 17.08.2012

Quote:

forward AutoOpen(playerid);
public AutoOpen(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(playerid, 2712.89990234, -1073.19995117, 70.30000305))
{
MoveObject(gate,2712.89990234,-1073.19995117,63.30000305,2);
}
else
{
MoveObject(gate,2712.89990234,-1073.19995117,70.30000305,2);
}
}
}

|

What's Bad Here? O_O


Re: what isn't good in this code? - Killer#Mummy - 17.08.2012

Try replace

pawn Код:
if(PlayerToPoint(playerid, 2712.89990234, -1073.19995117, 70.30000305))
with

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2712.89990234, -1073.19995117, 70.30000305))



Re: what isn't good in this code? - Henkie - 17.08.2012

Quote:
Originally Posted by Killer#Mummy
Посмотреть сообщение
Try replace

pawn Код:
if(PlayerToPoint(playerid, 2712.89990234, -1073.19995117, 70.30000305))
with

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2712.89990234, -1073.19995117, 70.30000305))
No, you forgot the range.


pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2712.89990234, -1073.19995117, 70.30000305))
Now the door will open if you are within the range of 5 from the point.


Re: what isn't good in this code? - kesem140599 - 17.08.2012

its compiled , but now there is no Gate O_O?


Re: what isn't good in this code? - Henkie - 17.08.2012

Did you make a gate and assigned it to the variable gate?


Re: what isn't good in this code? - kesem140599 - 17.08.2012

ok , i try the code's,
the first , i didnt saw the gate there,
the second , i say the gate far from the Hq gate.. O_O


Re: what isn't good in this code? - Abreezy - 17.08.2012

You sure you got the correct coords for the gate to move to?


Re: what isn't good in this code? - kesem140599 - 17.08.2012

code :
forward AutoOpen(playerid);
public AutoOpen(playerid)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2712.89990234, -1073.19995117, 70.30000305))
{
MoveObject(gate,2712.89990234,-1073.19995117,63.30000305,2);
}
else
{
MoveObject(gate,2712.89990234,-1073.19995117,70.30000305,2);
}
}
}



The Normal Command:
if(strcmp(cmdtext, "/Open" ,true)==0)
{
MoveObject(gate, 1767.5032,2730.7378,21.9277, 2);
SendClientMessage(playerid, COLOR_WHITE, "дщтш рфъз бдцмзд..");
return 1;
}

if(strcmp(cmdtext, "/Close" ,true)==0)
{
MoveObject(gate, 1766.9000244141, 2730.1000976563, 12.60000038147, 4);
SendClientMessage(playerid, COLOR_WHITE, "дщтш рсвш бдцмзд.");
return 1;
}