24.08.2011, 08:49
(
Последний раз редактировалось GameStar.; 24.08.2011 в 10:32.
)
Gate Engine beta
The system is made to simply create gates.
1st First of all, if you want, you can switch it to the automatic gate opener.
If not, then no problem, because the system can be used, only the gates in / out closing we must solve. So whether this command will also work.
2nd The most important step is to how to create gates. This has two functions.
Gate_New(): Here you can specify that the port is open / closed state, the answer to how much distance (ie, how much distance to open up to someone), and movement speed.
Gate_Create(): The simplified version of previous function. If you want to set the speed of the coordinates before, but it's only the coordinates given.
Each set up will get a unique identification number, which refer to it later.
3rd The system also features countless others have, they only serve to change the data after it is created.
These should be highlighted:
Closure of the findings:
Or, if you want to close automatic opening for the meantime:
Once this is done, then the door will not open automatically. In this case, for example, you'r opening command is:
You can run the check, because it will not run itself. For example:
The OnPlayerOpenGate () function allows you to open a gate before (a player), so we can prevent the opening.
If you do not have a gate, then delete it:
Test script:
Callbacks:
forward OnGateOpen(gateid); - is called when the gate opens
forward OnGateClose(gateid); - is called when the gate closes
forward OnPlayerOpenGate(playerid, gateid); - is called before the gate opens
Functions:
Download:
http://solidfiles.com/d/a4a3f/
Bugs? Ideas?
Post it!
Thanks to:
The system is made to simply create gates.
1st First of all, if you want, you can switch it to the automatic gate opener.
Quote:
Gate_Init(); |
2nd The most important step is to how to create gates. This has two functions.
Gate_New(): Here you can specify that the port is open / closed state, the answer to how much distance (ie, how much distance to open up to someone), and movement speed.
Gate_Create(): The simplified version of previous function. If you want to set the speed of the coordinates before, but it's only the coordinates given.
Each set up will get a unique identification number, which refer to it later.
3rd The system also features countless others have, they only serve to change the data after it is created.
These should be highlighted:
pawn Код:
Gate_Open () - Open the gate
Gate_Close () - Close the gate
Gate_IsOpened () - To determine if the door is open
pawn Код:
#define Gate_IsClosed(%1) (!Gate_IsOpened(%1))
pawn Код:
Gate_ToggleAutoResponse (mygate, 0);
pawn Код:
COMMAND:open(playerid)
{
Gate_Open(mygate);
return 1;
}
pawn Код:
COMMAND:open(playerid)
{
if(funcidx("OnPlayerOpenGate"))
{
if(!CallRemoteFunction("OnPlayerOpenGate", "ii", playerid, mygate)) return 0;
}
Gate_Open(mygate);
return 1;
}
If you do not have a gate, then delete it:
pawn Код:
Gate_Remove(mygate);
pawn Код:
#include <a_samp>
#include <gate>
#include <zcmd>
// Define coordinates
#define CLOSE -1515.4235, -263.9250, 6.0117
#define OPEN -1515.4387, -263.9299, 1.5194
new mygate = 0;
public OnFilterScriptInit()
{
Gate_Init();
mygate = Gate_Create(971, OPEN, CLOSE);
return 1;
}
public OnFilterScriptExit()
{
Gate_Remove(mygate);
return 1;
}
// Gate only for team '50'
public OnPlayerOpenGate(playerid, gateid)
{
if(GetPlayerTeam(playerid) != 50) return 0; // Don't open the gate
return 1;
}
// Team changer command's
COMMAND:team(playerid)
{
SetPlayerTeam(playerid, 50);
return 1;
}
COMMAND:team2(playerid)
{
SetPlayerTeam(playerid, NO_TEAM);
return 1;
}
forward OnGateOpen(gateid); - is called when the gate opens
forward OnGateClose(gateid); - is called when the gate closes
forward OnPlayerOpenGate(playerid, gateid); - is called before the gate opens
Functions:
pawn Код:
Gate_IsActive(gateid)
Gate_IsValid(gateid)
Gate_SetResponseDistance(gateid, Float:dis)
Gate_GetResponseDistance(gateid, &Float:dis)
Gate_SetSpeed(gateid, Float:speed)
Gate_GetSpeed(gateid, &Float:speed)
Gate_SetModel(gateid, modelid)
Gate_GetModel(gateid)
Gate_ToggleAutoResponse(gateid, toggle)
Gate_IsAutoResponse(gateid)
Gate_GetObjectID(gateid)
Gate_IsOpened(gateid)
Gate_SetRot(gateid, Float:rx, Float:ry, Float:rz)
Gate_GetRot(gateid, &Float:rx, &Float:ry, &Float:rz)
Gate_SetOpenPos(gateid, Float:x, Float:y, Float:z)
Gate_SetClosePos(gateid, Float:x, Float:y, Float:z)
Gate_GetClosePos(gateid, &Float:x, &Float:y, &Float:z)
Gate_Open(gateid)
Gate_Close(gateid)
Gate_New(modelid, open, autores, Float:resdis, Float:speed, Float:open_x, Float:open_y, Float:open_z, Float:close_x, Float:close_y, Float:close_z, Float:rot_x = 0.0, Float:rot_y = 0.0, Float:rot_z = 0.0)
Gate_Create(modelid, Float:open_x, Float:open_y, Float:open_z, Float:close_x, Float:close_y, Float:close_z, Float:rot_x = 0.0, Float:rot_y = 0.0, Float:rot_z = 0.0)
Gate_Remove(gateid)
Gate_Init()
http://solidfiles.com/d/a4a3f/
Bugs? Ideas?
Post it!
Thanks to:
- Sensitive - Translating
- Incognito - GVar, Streamer
- ******