13.03.2010, 22:46
What? Okay, look. Here is the code for a moving gate...
You must have the gate object codes, you have to have the code when it is closed, and when it is opened.
As you can use common sense the /ah3open moves the gate from closed position, to open. So use your cords accordingly. Vice versa with the close command.
Gate1 is a variable... So at the top of your script, you would need...
As for the Gate1 object codes... You would need to add the variable. Like so.
As for the MoveObject, I will explain.
Gate1 is the variable, the next three codes, (829.798,-2067.799,8.735) are the XYZ cords of the gate in either opened or closed position. The last code, (3.0) is the speed the gate will open/close.
To find more information on this topic, either PM me, or use the Wiki SA:MP page. You could ALSO use the SEARCH function on this forum.
*Read the rules too, since you are new to the forums... If you need help, PM a moderator, or someone like me.
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ah3open", true)==0)
{
SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
MoveObject(Gate1, 829.798,-2067.799,8.735, 3.0);
return 1;
}
if(strcmp(cmdtext, "/ah3close", true)==0)
{
SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
MoveObject(Gate1,829.784,-2067.690,14.727);
return 1;
}
}
return 1;
}
As you can use common sense the /ah3open moves the gate from closed position, to open. So use your cords accordingly. Vice versa with the close command.
Gate1 is a variable... So at the top of your script, you would need...
pawn Code:
new Gate1;
pawn Code:
Gate1 = CreateObject(980,829.784,-2067.690,14.727,0.0,0.0,0.0);
pawn Code:
MoveObject(Gate1, 829.798,-2067.799,8.735, 3.0);
To find more information on this topic, either PM me, or use the Wiki SA:MP page. You could ALSO use the SEARCH function on this forum.
*Read the rules too, since you are new to the forums... If you need help, PM a moderator, or someone like me.