Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //na górze kodu:
- new ObiektBrama;
- new bool:BramaOtwarta = false;
- new BramaTimer = 0;
- new Hedge[9];
- //w OnGameModeInit:
- ObiektBrama = CreateDynamicObject(971, 1003.05469, -644.46228, 124.12270, 0.00000, 0.00000, 202.50000);
- Hedge[0] = CreateDynamicObject(19450, 994.09442, -647.58691, 125.32930, 0.00000, 0.00000, -69.00000);
- Hedge[1] = CreateDynamicObject(19450, 985.13251, -650.99402, 125.32930, 0.00000, 0.00000, -69.00000);
- Hedge[2] = CreateDynamicObject(19450, 976.53876, -655.19031, 125.32930, 0.00000, 0.00000, -59.16000);
- Hedge[3] = CreateDynamicObject(19450, 968.27069, -660.12183, 125.32930, 0.00000, 0.00000, -59.16000);
- Hedge[4] = CreateDynamicObject(19450, 960.00513, -665.05450, 125.32930, 0.00000, 0.00000, -59.16000);
- Hedge[5] = CreateDynamicObject(19450, 951.74170, -669.98712, 125.32930, 0.00000, 0.00000, -59.16000);
- Hedge[6] = CreateDynamicObject(19450, 1011.52808, -646.25287, 124.42931, 0.00000, 0.00000, 37.44000);
- Hedge[7] = CreateDynamicObject(19450, 1017.38470, -653.90143, 124.42930, 0.00000, 0.00000, 37.44000);
- Hedge[8] = CreateDynamicObject(19450, 1023.24408, -661.54761, 124.42930, 0.00000, 0.00000, 37.44000);
- SetDynamicObjectMaterial(Hedge[0], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[1], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[2], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[3], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[4], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[5], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[6], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[7], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- SetDynamicObjectMaterial(Hedge[8], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
- //Gdzieś na dole kodu:
- CMD:brama(playerid)
- {
- if(GetPlayerDistanceFromPoint(playerid, 1003.1, -644.5, 124.12270) < 10)
- {
- if(BramaTimer)
- KillTimer(BramaTimer);
- if(BramaOtwarta)
- {
- BramaTimer = SetTimerEx("PrzesunBrame", 20, true, "d", false); //Zamykanie bramy
- BramaOtwarta = false;
- }
- else
- {
- BramaTimer = SetTimerEx("PrzesunBrame", 20, true, "d", true); //Otwieranie bramy
- BramaOtwarta = true;
- }
- }
- return 1;
- }
- forward PrzesunBrame(bool:czy_otwiera); //Jeśli true - otwieramy bramę; jeśli false - zamykamy bramę
- public PrzesunBrame(bool:czy_otwiera)
- {
- new Float:pos[3];
- GetDynamicObjectPos(ObiektBrama, pos[0], pos[1], pos[2]);
- if(czy_otwiera && pos[0]<=996.1 || !czy_otwiera && pos[0]>=1003.1) //Czyli skończyła się już otwierać/zamykać
- {
- KillTimer(BramaTimer);
- BramaTimer = 0;
- return 1;
- }
- if(czy_otwiera)
- SetDynamicObjectPos(ObiektBrama, pos[0]-0.07, pos[1]-0.028, pos[2]);
- else
- SetDynamicObjectPos(ObiektBrama, pos[0]+0.07, pos[1]+0.028, pos[2]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement