08.12.2011, 23:52
Alright, i'm making an LSPD gate near the garage. When i type /gate, the thing moves ups. I then type /gate again, and it says "The gate is now closing" but it stays up. Not sure why it isn't working, here is the script:
((Using ZCMD))
Tip: The gate moves when i type /gate first, like, it says "The gate is opening", which means that inside the brackets worked and it moves the gate. But when i do it again, it checks if it is open, and it does, then it says "The gate is closing!" and it stays up, it doesn't move.
This is probably just an easy fix.
PS: I'm a newbie in Pawn.
((Using ZCMD))
pawn Код:
// Top of script:
new Gateopen;
new LSPDGate;
// OnGameModeInit:
LSPDGate = CreateObject(968, 1544.6600341797, -1623.9599609375, 13.10000038147, 0, 270, 90); //Creating the object
//Somewhere at the bottom of the script
CMD:gate(playerid, params[])
{
if(Gateopen == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1544.6600341797, -1623.9599609375, 13.10000038147))
{
MoveObject(LSPDGate, 1544.6591796875, -1623.9599609375, 13.10000038147, 5);
SendClientMessage(playerid, 0xEF994300, "The gate is opening!");
Gateopen = 1;
}
else
{
SendClientMessage(playerid, 0xEF994300, "You are not in range of a gate!");
}
}
else if(Gateopen == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1544.6591796875, -1623.9599609375, 13.10000038147))
{
MoveObject(LSPDGate, 1544.6600341797, -1623.9599609375, 13.10000038147, 5);
SendClientMessage(playerid, 0xEF994300, "The gate is closing!");
Gateopen = 0;
}
else
{
SendClientMessage(playerid, 0xEF994300, "You are not in range of a gate!");
}
}
return 1;
}
This is probably just an easy fix.
PS: I'm a newbie in Pawn.