SA-MP Forums Archive
Making a gate with /open command - 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: Making a gate with /open command (/showthread.php?tid=88194)



Making a gate with /open command - IceColdBaby0o - 24.07.2009

Yo all i want to make an gate that i can do /closegate /opengate.
And i readed Before post but i only find Automatic open gate.
But i want manual open with command.

Im a bit new in scripting.


Re: Making a gate with /open command - RyDeR` - 24.07.2009

Use MoveObject

Example here:
https://sampwiki.blast.hk/wiki/MoveObject


Re: Making a gate with /open command - MenaceX^ - 24.07.2009

pawn Код:
if(!strcmp(cmdtext,"/open",true))
{
  if(!PlayerToPoint(distance,playerid,x,y,z))
    return SendClientMessage(playerid,color,"You have to stand near a moving gate.");
  MoveObject(objectid,x,y,z);
  return SendClientMessage(playerid,color,"Gate opened.");
}



Re: Making a gate with /open command - RyDeR` - 24.07.2009

Don't forget these on else you got an error

Код:
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
  new Float:oldpos[3], Float:temppos[3];
  GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
  temppos[0] = (oldpos[0] -X);
  temppos[1] = (oldpos[1] -Y);
  temppos[2] = (oldpos[2] -Z);
  if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
  {
    return true;
  }
  return false;
}



Re: Making a gate with /open command - IceColdBaby0o - 24.07.2009

whoot i get nothing


Re: Making a gate with /open command - Luciano - 25.07.2009

You must edit their code to get what you want.


Re: Making a gate with /open command - IceColdBaby0o - 25.07.2009

oldpos?