SHOW:
|
|
- or go back to the newest paste.
1 | #include <a_samp> | |
2 | #include <zcmd> | |
3 | #include <streamer> | |
4 | #define MAX_PORTALS 200 | |
5 | #define PRESSED(%0) \ | |
6 | (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) | |
7 | ||
8 | enum pInfo | |
9 | { | |
10 | pCreated[2], | |
11 | Float:pPos[6], | |
12 | pCount, | |
13 | pObject[2], | |
14 | Text3D:PortalText[2], | |
15 | }; | |
16 | new PortalInfo[MAX_PORTALS][pInfo]; | |
17 | new gunMode[MAX_PLAYERS]; | |
18 | new TPed[MAX_PLAYERS]; | |
19 | ||
20 | public OnFilterScriptInit() | |
21 | { | |
22 | for(new i; i < MAX_PORTALS; i++) { i = 0; return 1;} | |
23 | print(" Multifunctional Bullets - [Cannary2048]"); | |
24 | return 1; | |
25 | } | |
26 | ||
27 | forward UnFreeze(playerid); | |
28 | public UnFreeze(playerid) | |
29 | { | |
30 | TogglePlayerControllable(playerid, 1); | |
31 | TPed[playerid] = 0; | |
32 | return 1; | |
33 | } | |
34 | ||
35 | public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) | |
36 | { | |
37 | if(newkeys == KEY_CROUCH && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) | |
38 | { | |
39 | for(new i = 0; i < sizeof(PortalInfo); i++) | |
40 | { | |
41 | if(PortalInfo[i][pCreated][0] == 1 && PortalInfo[i][pCreated][1] == 1) | |
42 | { | |
43 | if(IsPlayerInRangeOfPoint(playerid, 2.5, PortalInfo[i][pPos][3], PortalInfo[i][pPos][4], PortalInfo[i][pPos][5]) && TPed[playerid] == 0) | |
44 | { | |
45 | SetPlayerPos(playerid, PortalInfo[i][pPos][0], PortalInfo[i][pPos][1], PortalInfo[i][pPos][2]); | |
46 | TogglePlayerControllable(playerid, 0); | |
47 | SetTimerEx("UnFreeze", 1000, false, "i", playerid); | |
48 | TPed[playerid] = 1; | |
49 | } | |
50 | if(IsPlayerInRangeOfPoint(playerid, 2.5, PortalInfo[i][pPos][0], PortalInfo[i][pPos][1], PortalInfo[i][pPos][2]) && TPed[playerid] == 0) | |
51 | { | |
52 | SetPlayerPos(playerid, PortalInfo[i][pPos][3], PortalInfo[i][pPos][4], PortalInfo[i][pPos][5]); | |
53 | TogglePlayerControllable(playerid, 0); | |
54 | SetTimerEx("UnFreeze", 1000, false, "i", playerid); | |
55 | TPed[playerid] = 1; | |
56 | } | |
57 | } | |
58 | } | |
59 | return 1; | |
60 | } | |
61 | if (PRESSED( KEY_WALK | KEY_YES )) | |
62 | { | |
63 | new string[64]; | |
64 | gunMode[playerid] += 1; | |
65 | if(gunMode[playerid] == 1) { format(string, sizeof(string), "MODE: {3399FF}Portal"); } | |
66 | if(gunMode[playerid] == 2) { format(string, sizeof(string), "MODE: {FFFF00}Exploding"); } | |
67 | if(gunMode[playerid] == 3) { format(string, sizeof(string), "MODE: {808080}Drunk"); } | |
68 | if(gunMode[playerid] > 3) { gunMode[playerid] = 0; format(string, sizeof(string), "MODE: Normal"); } | |
69 | SendClientMessage(playerid, -1, string); | |
70 | } | |
71 | return 1; | |
72 | } | |
73 | ||
74 | stock CreatePortal(Float:x, Float:y, Float:z) | |
75 | { | |
76 | for(new i = 0; i < sizeof(PortalInfo); i++) | |
77 | { | |
78 | if(PortalInfo[i][pCreated][0] == 0 && PortalInfo[i][pCreated][1] == 0) | |
79 | { | |
80 | PortalInfo[i][pCreated][0] = 1; | |
81 | PortalInfo[i][pPos][0] = x; | |
82 | PortalInfo[i][pPos][1] = y; | |
83 | PortalInfo[i][pPos][2] = z; | |
84 | PortalInfo[i][pObject][0] = CreateObject(19256, x, y, z, 0, 0, 0); | |
85 | PortalInfo[i][pCount] += 1; | |
86 | PortalInfo[i][PortalText][0] = Create3DTextLabel("{3399FF}[Portal]{FFFFFF}\nC to Teleport\nC-248 {99FF33}Science{FFFFFF} Division", 0xFFFFFFFF, x, y, z+0.2, 10.0, 0, 0); | |
87 | return 1; | |
88 | } | |
89 | if(PortalInfo[i][pCreated][0] == 1 && PortalInfo[i][pCreated][1] == 0) | |
90 | { | |
91 | PortalInfo[i][pPos][3] = x; | |
92 | PortalInfo[i][pPos][4] = y; | |
93 | PortalInfo[i][pPos][5] = z; | |
94 | PortalInfo[i][pObject][1] = CreateObject(19256, x, y, z, 0, 0, 0); | |
95 | PortalInfo[i][pCount] += 1; | |
96 | PortalInfo[i][PortalText][1] = Create3DTextLabel("{FF9933}[Portal]{FFFFFF}\nC to Teleport\nC-248 {99FF33}Science{FFFFFF} Division", 0xFFFFFFFF, x, y, z+0.2, 10.0, 0, 0); | |
97 | PortalInfo[i][pCreated][1] = 1; | |
98 | return 1; | |
99 | } | |
100 | if(PortalInfo[i][pCount] == MAX_PORTALS) { return DeleteAllPortals(); } | |
101 | } | |
102 | return 0; | |
103 | } | |
104 | ||
105 | CMD:clear(playerid, params[]) | |
106 | { | |
107 | DeleteAllPortals(); | |
108 | return 1; | |
109 | } | |
110 | ||
111 | public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) | |
112 | { | |
113 | - | if(gunMode[issuerid] == 3) |
113 | + | if(gunMode[issuerid] == 3 && GetPlayerWeapon(playerid) > 0 && playerid != issuerid) |
114 | { | |
115 | - | SetPlayerDrunkLevel(playerid, 6000); |
115 | + | SetPlayerDrunkLevel(playerid, 6000); |
116 | - | SetTimerEx("UnDrunk", 25000, false, "i", playerid); |
116 | + | SetTimerEx("UnDrunk", 25000, false, "i", playerid); |
117 | } | |
118 | return 1; | |
119 | } | |
120 | ||
121 | forward UnDrunk(playerid); | |
122 | public UnDrunk(playerid) | |
123 | { | |
124 | SetPlayerDrunkLevel(playerid, 0); | |
125 | return 1; | |
126 | } | |
127 | ||
128 | stock DeleteAllPortals() | |
129 | { | |
130 | for(new i = 0; i < sizeof(PortalInfo); i++) | |
131 | { | |
132 | if(PortalInfo[i][pCreated][0] == 1 && PortalInfo[i][pCreated][1] == 1) | |
133 | { | |
134 | PortalInfo[i][pCreated]=0; | |
135 | PortalInfo[i][pPos][0]=0.0; | |
136 | PortalInfo[i][pPos][1]=0.0; | |
137 | PortalInfo[i][pPos][2]=0.0; | |
138 | PortalInfo[i][pPos][3]=0.0; | |
139 | PortalInfo[i][pPos][4]=0.0; | |
140 | PortalInfo[i][pPos][5]=0.0; | |
141 | PortalInfo[i][pCount] = 0; | |
142 | DestroyObject(PortalInfo[i][pObject][0]); | |
143 | DestroyObject(PortalInfo[i][pObject][1]); | |
144 | Delete3DTextLabel(Text3D:PortalInfo[i][PortalText][0]); | |
145 | Delete3DTextLabel(Text3D:PortalInfo[i][PortalText][1]); | |
146 | } | |
147 | } | |
148 | return 0; | |
149 | } | |
150 | ||
151 | ||
152 | public OnFilterScriptExit() | |
153 | { | |
154 | return 1; | |
155 | } | |
156 | ||
157 | GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) | |
158 | { | |
159 | new Float:a; | |
160 | GetPlayerPos(playerid, x, y, a); | |
161 | GetPlayerFacingAngle(playerid, a); | |
162 | if (GetPlayerVehicleID(playerid)) | |
163 | { | |
164 | GetVehicleZAngle(GetPlayerVehicleID(playerid), a); | |
165 | } | |
166 | x += (distance * floatsin(-a, degrees)); | |
167 | y += (distance * floatcos(-a, degrees)); | |
168 | } | |
169 | ||
170 | CMD:gun(playerid, params[]) | |
171 | { | |
172 | GivePlayerWeapon(playerid, 23, 100); | |
173 | GivePlayerWeapon(playerid, 34, 100); | |
174 | GivePlayerWeapon(playerid, 38, 100); | |
175 | return 1; | |
176 | } | |
177 | ||
178 | public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) | |
179 | { | |
180 | if(hittype == 0 || hittype == 3) | |
181 | { | |
182 | if(gunMode[playerid] == 1 && GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 23) | |
183 | { | |
184 | new Float: A, Float: rX, Float: rY; | |
185 | GetXYInFrontOfPlayer(playerid, rX, rY, 5.0); | |
186 | GetPlayerFacingAngle(playerid, A); | |
187 | CreatePortal(fX, fY, fZ); | |
188 | } | |
189 | if(gunMode[playerid] == 2 && GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 23) | |
190 | { | |
191 | CreateExplosion(fX, fY, fZ, 12, 5.0); | |
192 | } | |
193 | } | |
194 | } |