Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: Johurt(ES.^, Edgar).
- Date: 16-02-2013.
- */
- #include <a_samp>
- #define MAX_AGATES 2
- enum agItem
- {
- Model,
- Float:oPosX,
- Float:oPosY,
- Float:oPosZ,
- Float:oPosrX,
- Float:oPosrY,
- Float:oPosrZ,
- Float:cPosX,
- Float:cPosY,
- Float:cPosZ,
- Float:cPosrX,
- Float:cPosrY,
- Float:cPosrZ,
- Float:oSpeed,
- Float:cSpeed,
- Float:DrawDistance,
- Float:pPosX,
- Float:pPosY,
- Float:pPosZ,
- Float:pRange
- }
- new bool:GatesState[MAX_AGATES], GatesID[MAX_AGATES];
- new caGates[MAX_AGATES][agItem] =
- {
- {988, -1543.742, -432.703, 6.039, 0.0, 0.0, -45.0, -1540.66, -435.786, 6.039, 0.0, 0.0, -45.0, 3.0, 3.0, 300.0, -1545.9380, -430.9962, 6.0, 20.0},
- {988, -1547.625, -428.82, 6.039, 0.0, 0.0, -45.0, -1550.709, -425.736, 6.039, 0.0, 0.0, -45.0, 3.0, 3.0, 300.0, -1545.9380, -430.9962, 6.0, 20.0}
- };
- public OnFilterScriptInit()
- {
- for(new g; g < MAX_AGATES; g++) GatesID[g] = CreateObject(caGates[g][Model], caGates[g][oPosX], caGates[g][oPosY], caGates[g][oPosZ], caGates[g][oPosrX], caGates[g][oPosrY], caGates[g][oPosrZ], caGates[g][DrawDistance]);
- SetTimer("AutoGates", 1000, true);
- return 1;
- }
- forward AutoGates();
- public AutoGates()
- {
- new bool:cGates[MAX_AGATES];
- for(new p; p < MAX_PLAYERS; p++)
- {
- if(IsPlayerConnected(p) && !IsPlayerNPC(p))
- {
- for(new g; g < MAX_AGATES; g++)
- {
- if(IsPlayerInRangeOfPoint(p, caGates[g][pRange], caGates[g][pPosX], caGates[g][pPosY], caGates[g][pPosZ]))
- {
- cGates[g] = true;
- if(!GatesState[g])
- {
- GatesState[g] = true;
- MoveObject(GatesID[g], caGates[g][cPosX], caGates[g][cPosY], caGates[g][cPosZ], caGates[g][cSpeed], caGates[g][cPosrX], caGates[g][cPosrY], caGates[g][cPosrZ]);
- }
- }
- }
- }
- }
- for(new g; g < MAX_AGATES; g++)
- {
- if(!cGates[g] && GatesState[g])
- {
- cGates[g] = false;
- GatesState[g] = false;
- MoveObject(GatesID[g], caGates[g][oPosX], caGates[g][oPosY], caGates[g][oPosZ], caGates[g][oSpeed], caGates[g][oPosrX], caGates[g][oPosrY], caGates[g][oPosrZ]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement