SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | System kierunkowskazów by xqz | |
3 | 24.06.2013r. 13:17 :) | |
4 | ||
5 | /on command | |
6 | */ | |
7 | ||
8 | ||
9 | ||
10 | ||
11 | ||
12 | #include a_samp | |
13 | #include zcmd | |
14 | ||
15 | new Indicators_xqz[MAX_VEHICLES][6]; | |
16 | ||
17 | ||
18 | stock SetVehicleIndicator(vehicleid, leftindicator=0, rightindicator=0) | |
19 | { | |
20 | if(!leftindicator & !rightindicator) return false; | |
21 | new Float:_vX[2], Float:_vY[2], Float:_vZ[2]; | |
22 | if(rightindicator) | |
23 | { | |
24 | if(IsTrailerAttachedToVehicle(vehicleid)) | |
25 | { | |
26 | new omg = GetVehicleModel(GetVehicleTrailer(vehicleid)); | |
27 | GetVehicleModelInfo(omg, VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]); | |
28 | Indicators_xqz[vehicleid][4] = CreateObject(19294, 0, 0, 0,0,0,0); | |
29 | AttachObjectToVehicle(Indicators_xqz[vehicleid][4], GetVehicleTrailer(vehicleid), _vX[0]/2.4, -_vY[0]/3.35, -1.0 ,0,0,0); | |
30 | } | |
31 | GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]); | |
32 | Indicators_xqz[vehicleid][0] = CreateObject(19294, 0, 0, 0,0,0,0); | |
33 | AttachObjectToVehicle(Indicators_xqz[vehicleid][0], vehicleid, _vX[0]/2.23, _vY[0]/2.23, 0.1 ,0,0,0); | |
34 | Indicators_xqz[vehicleid][1] = CreateObject(19294, 0, 0, 0,0,0,0); | |
35 | AttachObjectToVehicle(Indicators_xqz[vehicleid][1], vehicleid, _vX[0]/2.23, -_vY[0]/2.23, 0.1 ,0,0,0); | |
36 | } | |
37 | if(leftindicator) | |
38 | { | |
39 | if(IsTrailerAttachedToVehicle(vehicleid)) | |
40 | { | |
41 | new omg = GetVehicleModel(GetVehicleTrailer(vehicleid)); | |
42 | GetVehicleModelInfo(omg, VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]); | |
43 | Indicators_xqz[vehicleid][5] = CreateObject(19294, 0, 0, 0,0,0,0); | |
44 | AttachObjectToVehicle(Indicators_xqz[vehicleid][5], GetVehicleTrailer(vehicleid), -_vX[0]/2.4, -_vY[0]/3.35, -1.0 ,0,0,0); | |
45 | } | |
46 | GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]); | |
47 | Indicators_xqz[vehicleid][2] = CreateObject(19294, 0, 0, 0,0,0,0); | |
48 | AttachObjectToVehicle(Indicators_xqz[vehicleid][2], vehicleid, -_vX[0]/2.23, _vY[0]/2.23, 0.1 ,0,0,0); | |
49 | Indicators_xqz[vehicleid][3] = CreateObject(19294, 0, 0, 0,0,0,0); | |
50 | AttachObjectToVehicle(Indicators_xqz[vehicleid][3], vehicleid, -_vX[0]/2.23, -_vY[0]/2.23, 0.1 ,0,0,0); | |
51 | } | |
52 | - | public OnPlayerKeyStateChange(playerid,newkeys, oldkeys) |
52 | + | |
53 | } | |
54 | ||
55 | CMD:both(playerid,params[]) | |
56 | { | |
57 | if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2) | |
58 | { | |
59 | - | if(newkeys & ( KEY_LOOK_LEFT ) && newkeys & ( KEY_LOOK_RIGHT )) |
59 | + | |
60 | - | { |
60 | + | |
61 | - | if(Indicators_xqz[vid][2] /*|| Indicators_xqz[vid][5]*/) DestroyObject(Indicators_xqz[vid][5]),DestroyObject(Indicators_xqz[vid][2]), DestroyObject(Indicators_xqz[vid][3]),Indicators_xqz[vid][2]=0; |
61 | + | |
62 | if(Indicators_xqz[vid][2] /*|| Indicators_xqz[vid][5]*/) DestroyObject(Indicators_xqz[vid][5]),DestroyObject(Indicators_xqz[vid][2]), DestroyObject(Indicators_xqz[vid][3]),Indicators_xqz[vid][2]=0; | |
63 | - | else |
63 | + | |
64 | - | SetVehicleIndicator(vid,1,1); |
64 | + | else |
65 | - | return 1; |
65 | + | SetVehicleIndicator(vid,1,1); |
66 | return 1; | |
67 | - | if(newkeys & KEY_LOOK_RIGHT) |
67 | + | |
68 | - | { |
68 | + | |
69 | - | if(Indicators_xqz[vid][0] /*|| Indicators_xqz[vid][4]*/) DestroyObject(Indicators_xqz[vid][4]), DestroyObject(Indicators_xqz[vid][0]), DestroyObject(Indicators_xqz[vid][1]),Indicators_xqz[vid][0]=0; |
69 | + | |
70 | } | |
71 | - | else |
71 | + | |
72 | - | SetVehicleIndicator(vid,0,1); |
72 | + | CMD:right(playerid,params[]) |
73 | { | |
74 | - | if(newkeys & KEY_LOOK_LEFT) |
74 | + | |
75 | - | { |
75 | + | |
76 | - | if(Indicators_xqz[vid][2]/*|| Indicators_xqz[vid][5]*/) DestroyObject(Indicators_xqz[vid][5]),DestroyObject(Indicators_xqz[vid][2]), DestroyObject(Indicators_xqz[vid][3]),Indicators_xqz[vid][2]=0; |
76 | + | |
77 | - | else if(Indicators_xqz[vid][0] /*|| Indicators_xqz[vid][4]*/) DestroyObject(Indicators_xqz[vid][4]),DestroyObject(Indicators_xqz[vid][0]), DestroyObject(Indicators_xqz[vid][1]),Indicators_xqz[vid][0]=0; |
77 | + | |
78 | - | else |
78 | + | if(Indicators_xqz[vid][0] /*|| Indicators_xqz[vid][4]*/) DestroyObject(Indicators_xqz[vid][4]), DestroyObject(Indicators_xqz[vid][0]), DestroyObject(Indicators_xqz[vid][1]),Indicators_xqz[vid][0]=0; |
79 | else if(Indicators_xqz[vid][2]/*|| Indicators_xqz[vid][5]*/) DestroyObject(Indicators_xqz[vid][5]), DestroyObject(Indicators_xqz[vid][2]), DestroyObject(Indicators_xqz[vid][3]),Indicators_xqz[vid][2]=0; | |
80 | else | |
81 | SetVehicleIndicator(vid,0,1); | |
82 | } | |
83 | } | |
84 | return 1; | |
85 | } | |
86 | CMD:left(playerid,params[]) | |
87 | { | |
88 | if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2) | |
89 | { | |
90 | if(!IsAPlane(GetPlayerVehicleID(playerid)) && !IsABoat(GetPlayerVehicleID(playerid))) | |
91 | { | |
92 | if(Indicators_xqz[vid][2]/*|| Indicators_xqz[vid][5]*/) DestroyObject(Indicators_xqz[vid][5]),DestroyObject(Indicators_xqz[vid][2]), DestroyObject(Indicators_xqz[vid][3]),Indicators_xqz[vid][2]=0; | |
93 | else if(Indicators_xqz[vid][0] /*|| Indicators_xqz[vid][4]*/) DestroyObject(Indicators_xqz[vid][4]),DestroyObject(Indicators_xqz[vid][0]), DestroyObject(Indicators_xqz[vid][1]),Indicators_xqz[vid][0]=0; | |
94 | else | |
95 | SetVehicleIndicator(vid,1,0); | |
96 | } | |
97 | } | |
98 | return 1; | |
99 | } | |
100 | ||
101 | ||
102 | public OnVehicleDeath(vehicleid) | |
103 | { | |
104 | if(Indicators_xqz[vehicleid][2]) DestroyObject(Indicators_xqz[vehicleid][2]), DestroyObject(Indicators_xqz[vehicleid][3]),DestroyObject(Indicators_xqz[vehicleid][5]),Indicators_xqz[vehicleid][2]=0; | |
105 | if(Indicators_xqz[vehicleid][0]) DestroyObject(Indicators_xqz[vehicleid][0]), DestroyObject(Indicators_xqz[vehicleid][1]),DestroyObject(Indicators_xqz[vehicleid][4]),Indicators_xqz[vehicleid][0]=0; | |
106 | return 1; | |
107 | } | |
108 | ||
109 | stock IsAPlane(carid2) | |
110 | { | |
111 | new carid = GetVehicleModel(carid2); | |
112 | if(carid == 592 || carid == 577 || carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 519 || carid == 460 || carid == 513) return 1; | |
113 | return 0; | |
114 | } | |
115 | ||
116 | stock IsABoat(carid) | |
117 | { | |
118 | new modelid = GetVehicleModel(carid); | |
119 | if(modelid == 430 || modelid == 446 || modelid == 452 || modelid == 453 || modelid == 454 || modelid == 472 || modelid == 473 || modelid == 484 || modelid == 493 || modelid == 595) | |
120 | { | |
121 | return 1; | |
122 | } | |
123 | return 0; | |
124 | } |