30.07.2014, 20:34
I don't know on what level of pawn skills you are at, so I will just tell you what to do and if you don't know how to do any of the below, you ask.
First, declare variables that will hold the ID of the door objects that will be created. Just name it anything, for example:
Under OnGameModeInit(), create the objects and assign the previous variables to them. When the function used for creation of objects is called, it returns the ID of the created object and we want that ID because we will need it to move the door. Right? So...
Haven't got a clue what command system you are using, but you can change the code in adequate places. When you use the command, you want to check which door the player is next to. Use the proximity detector function as a condition:
Obviously, the coordinates that you put into the above function have to be the object coordinates. If the 'if' condition is satisfied, you can move onto the actual moving. So you just move the object using the function you mentioned and the ID we stored in the door_pd_1 variable...
First, declare variables that will hold the ID of the door objects that will be created. Just name it anything, for example:
Код:
new door_pd_1;
Код:
door_pd_1 = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance);
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) // rest of code
Код:
MoveObject(pd_door_1, x, y, z, speed);