Making a gate with /open command
#1

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.
Reply
#2

Use MoveObject

Example here:
https://sampwiki.blast.hk/wiki/MoveObject
Reply
#3

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.");
}
Reply
#4

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;
}
Reply
#5

whoot i get nothing
Reply
#6

You must edit their code to get what you want.
Reply
#7

oldpos?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)