SA-MP Forums Archive
grr, gate question - 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: grr, gate question (/showthread.php?tid=94409)



grr, gate question - balisticore - 29.08.2009

Hey nathan fuller again

Want to know something about gates.

Currently i have a gate at PD that can close and open on command. However, i can use this command any where on the map. I want to know if theres a way i can script a distance thing.. So if im more then say 10 feet the command wont work.


Re: grr, gate question - Mr_Finnigan - 29.08.2009

Use PlayertoPoint?


Re: grr, gate question - balisticore - 29.08.2009

i used it like.

if (strcmp("/openpdgate", cmdtext, true, 10) == 0)
{
MoveObject(pdgate1, 1549.95, -1621.68, 6.15, 2.0);
SendClientMessage(playerid, 0xFFFFFFAA, "Gate Now Opening");
return 1;
}

if(strcmp("/closepdgate", cmdtext, true, 10) == 0)
{
MoveObject(pdgate1,1549.95, -1621.68, 12.3, 2.0);
SendClientMessage(playerid, 0xFFFFFFAA, "Gate Now Closing");
return 1;
}



I also added the slash new gate and all that, gates work i just dono how to make it so u can only do it within a specific area


Re: grr, gate question - Abernethy - 29.08.2009

Use this. It will work fine.


Re: grr, gate question - balisticore - 29.08.2009

wow hehe im an idiot. i went to that link, put in everything it said.. am i supposed to change some of the X,Y,Z's or sumthin?


Re: grr, gate question - Abernethy - 29.08.2009

pawn Код:
if (strcmp("/openpdgate", cmdtext, true, 10) == 0)
    {
    if (PlayerToPoint(20.00, playerid, 1549.95, -1621.68, 12.3))
    {
      MoveObject(pdgate1, 1549.95, -1621.68, 6.15, 2.0);
      SendClientMessage(playerid, 0xFFFFFFAA, "Gate Now Opening");
    }
    else
    {
      SendClientMessage(playerid, 0xf01818FF, "Sorry, not in range of a gate.");
    }
  return 1;
    }

    if(strcmp("/closepdgate", cmdtext, true, 10) == 0)
    {
    if (PlayerToPoint(20.00, playerid, 1549.95, -1621.68, 12.3))
    {
      MoveObject(pdgate1,1549.95, -1621.68, 12.3, 2.0);
      SendClientMessage(playerid, 0xFFFFFFAA, "Gate Now Closing");
    else
    {
      SendClientMessage(playerid, 0xf01818FF, "Sorry, not in range of a gate.");
    }
    return 1;
    }
Try that.