Guest User

0Hide - Stealthy V2

a guest
Jun 20th, 2011
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. #if defined Hide__0
  2.  
  3. *# # # # # # # # # # # # # # # # #*
  4. *# 0Hide - V1.0 #*
  5. *# By Zh3r0 #*
  6. *# Created on: 17 June #*
  7. *# # # # # # # # # # # # # # # # #*
  8.  
  9. [Changelog]
  10. V1.0
  11. - Release
  12.  
  13. V2.0
  14. - Added more hide objects, check "/hideo".
  15. - Fixed name tag
  16. - Fixed color transparency.
  17.  
  18. Credits to Mauzen for the transparency code.
  19. [Information]
  20. - With this filterscript, when you are in-game type "/hide", now you have
  21. activated the script, now whenever you crouch, a flower pot will mask your
  22. presence!
  23.  
  24. #endif
  25.  
  26. #include < a_samp >
  27.  
  28.  
  29. #define PRESSED(%0) \
  30. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  31.  
  32. #define Loop:<%0,%1> \
  33. for( new %0; %0 < %1; %0++)
  34.  
  35. /*
  36. With this definition you cannot be bugged while hiding.
  37. Keeping it uncommented will remove the object each time
  38. you are not crouching using OnPlayerUpdate
  39.  
  40. Comment this if you are experiencing any lag from the script.
  41. */
  42. #define PERFECTION
  43. /*
  44.  
  45. */
  46. new
  47. bool:Activated[MAX_PLAYERS char],
  48. Hidden[MAX_PLAYERS char],
  49. CurrentObject[MAX_PLAYERS char]
  50. ;
  51. enum
  52. e_objects
  53. {
  54. o_id, o_n[15], o_b,
  55. Float:o_x, Float:o_y, Float:o_z,
  56. Float:o_rx, Float:o_ry, Float:o_rz,
  57. Float:o_sx, Float:o_sy, Float:o_sz
  58. }
  59.  
  60. enum
  61. e_dialogs
  62. {
  63. Empty = 5555,
  64. List = 5556
  65. }
  66.  
  67. new
  68. ObjectInfo[33][e_objects] =
  69. {
  70. {1221, "Box 1", 11, 0.331851, -0.387647, 0.108080, 62.871932, 3.603914, 279.105468, 1.500000, 1.500000, 1.500000},
  71. {1220, "Box 2",11, 0.331851, -0.387647, 0.108080, 62.871932, 3.603914, 279.105468, 1.500000, 1.500000, 1.500000},
  72. {2912, "Box 3", 10, -0.117735, -0.402220, -0.766344, 356.370971, 357.288360, 5.631556, 1.500000, 1.600000, 1.500000},
  73. {964, "Army Box", 11, 0.180357, 0.045067, -0.323517, 63.705467, 4.868588, 165.003601, 1.000000, 1.000000, 1.299999},
  74. {1271, "Gun Box", 11, 0.316308, -0.396371, 0.129949, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  75. {1367, "Post Box 1", 11, 0.230588, -0.647528, 0.151942, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  76. {1291, "Post Box 2", 11, 0.285487, -0.645864, 0.129949, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  77. {800, "Bush 1", 11, 0.366527, -0.542696, -0.005478, 35.919593, 8.222164, 141.222518, 0.432692, 0.400000, 0.400000},
  78. {823, "Bush 2", 11, 0.366527, -0.542696, -0.005478, 60.612785, 10.375102, 165.003601, 0.312109, 0.300000, 0.300000},
  79. {824, "Bush 3", 11, 0.366527, -0.542696, -0.005478, 60.612785, 10.375102, 165.003601, 0.312109, 0.300000, 0.300000},
  80. {825, "Bush 4", 11, 0.366527, -0.542696, -0.005478, 60.612785, 10.375102, 165.003601, 0.312109, 0.300000, 0.300000},
  81. {754, "Cactus Bush", 11, 0.312796, 0.180289, -0.285668, 63.705467, 4.868588, 165.003601, 1.200027, 1.252762, 2.480148},
  82. {653, "Cactus Plant", 11, -0.121614, 0.075794, -0.285668, 63.705467, 4.868588, 165.003601, 0.800000, 0.800000, 0.800000},
  83. {831, "Dead Tree", 11, 0.366527, -0.542696, -0.005478, 60.612785, 10.375102, 165.003601, 0.600000, 0.600000, 0.600000},
  84. {1370, "Flame Drum", 11, 0.230588, -0.647528, 0.151942, 63.663352, 5.211647, 103.045799, 1.500000, 1.500000, 1.500000},
  85. {1371, "Hippo Bin", 11, 0.230588, -0.647528, 0.151942, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  86. {1225, "Barrel 1", 11, 0.331851, -0.387647, 0.108080, 62.871932, 3.603914, 279.105468, 1.500000, 1.500000, 1.500000},
  87. {1222, "Barrel 2", 11, 0.331851, -0.387647, 0.108080, 62.871932, 3.603914, 279.105468, 1.500000, 1.500000, 1.500000},
  88. {1218, "Barrel 3", 11, 0.331851, -0.387647, 0.108080, 62.871932, 3.603914, 279.105468, 1.500000, 1.500000, 1.5000},
  89. {1217, "Barrel 4", 11, 0.331851, -0.387647, 0.108080, 62.871932, 3.603914, 279.105468, 1.500000, 1.500000, 1.500000},
  90. {1362, "Fire Bin", 11, 0.230588, -0.647528, 0.151942, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  91. {1347, "Waste Bin", 11, 0.230588, -0.647528, 0.151942, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  92. {1339, "Bin 1", 11, 0.230588, -0.647528, 0.151942, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  93. {1337, "Bin 2", 11, 0.230588, -0.647528, 0.151942, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  94. {1330, "Trash Can 1", 11, 0.285487, -0.587944, 0.121327, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  95. {1329, "Trash Can 2", 11, 0.285487, -0.645864, 0.129949, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  96. {1328, "Trash Can 3", 11, 0.285487, -0.645864, 0.129949, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  97. {1264, "Trash Bag", 11, 0.331851, -0.534445, -0.022953, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  98. {1237, "Barrier", 11, 0.331851, 0.015704, -0.173188, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  99. {1208, "Wash Machine", 11, 0.292449, 0.018611, -0.236802, 64.272399, 6.367418, 97.481346, 1.500000, 1.500000, 1.500000},
  100. {1304, "Rock 1", 11, 0.285487, -0.645864, 0.129949, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  101. {1303, "Rock 2", 11, 0.285487, -0.645864, 0.129949, 65.029396, 4.721271, 279.105468, 1.500000, 1.500000, 1.500000},
  102. {1305, "Rock 3", 11, 0.285487, -0.645864, 0.129949, 65.029396, 4.721271, 279.105468, 0.800000, 0.800000, 0.800000}
  103. };
  104. stock ToggleTagName(playerid, toggle)
  105. {
  106. Loop:<I, MAX_PLAYERS>
  107. {
  108. if(I != INVALID_PLAYER_ID)
  109. {
  110. ShowPlayerNameTagForPlayer(I, playerid, toggle);
  111. }
  112. }
  113. }
  114. stock StealthMode(playerid)
  115. {
  116. Hidden{playerid} = true;
  117. ToggleTagName(playerid, 0);
  118.  
  119. SetPlayerColor(playerid, GetPlayerColor(playerid) - (GetPlayerColor(playerid) & 0x000000FF) - 255);
  120.  
  121. SetPlayerAttachedObject
  122. (
  123. playerid,
  124. 0,
  125. ObjectInfo[CurrentObject{playerid}][o_id],
  126. ObjectInfo[CurrentObject{playerid}][o_b],
  127. ObjectInfo[CurrentObject{playerid}][o_x],
  128. ObjectInfo[CurrentObject{playerid}][o_y],
  129. ObjectInfo[CurrentObject{playerid}][o_z],
  130. ObjectInfo[CurrentObject{playerid}][o_rx],
  131. ObjectInfo[CurrentObject{playerid}][o_ry],
  132. ObjectInfo[CurrentObject{playerid}][o_rz],
  133. ObjectInfo[CurrentObject{playerid}][o_sx],
  134. ObjectInfo[CurrentObject{playerid}][o_sy],
  135. ObjectInfo[CurrentObject{playerid}][o_sz]
  136. );
  137. }
  138. stock RevealPlayer(playerid, toggle = 1)
  139. {
  140. Hidden{playerid} = false;
  141. SetPlayerColor(playerid, GetPlayerColor(playerid) - (GetPlayerColor(playerid) & 0x000000FF) + 255);
  142. RemovePlayerAttachedObject(playerid, 0);
  143. ToggleTagName(playerid, toggle);
  144. }
  145. stock ShowContent()
  146. {
  147. new Content[512];
  148.  
  149. strcat(Content, "{94ED40}0Hide - Stealthy Filterscript V2{FFFFFF}\n\n", 512);
  150. strcat(Content, "Created by {94ED40}Zh3r0{FFFFFF} on {94ED40}17 June{FFFFFF}\n", 512);
  151. strcat(Content, "Type {94ED40}/hide{FFFFFF} to activate/deactivate the stealth mode.!\n", 512);
  152. strcat(Content, "Type {94ED40}/hideo{FFFFFF} and choose your hiding object!\n\n", 512);
  153. strcat(Content, "(C)Zh3r0 - Keep the credits");
  154.  
  155. return Content;
  156. }
  157. public OnFilterScriptInit()
  158. {
  159. print("-\t\t\t\t\t -\n\n\
  160. \t|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\
  161. \t| 0Hide V2.0 |\n\
  162. \t| By Zh3r0 |\n\
  163. \t| Created on: 17 June |\n\
  164. \t| Updated on: 20 June |\n\
  165. \t|/////////////////////////\n\
  166. \n-\t\t\t\t\t -\n");
  167. return 1;
  168. }
  169. public OnPlayerConnect(playerid)
  170. {
  171. CurrentObject{playerid} = 0xFFFF;
  172. Activated{playerid} = false;
  173. SendClientMessage(playerid, ~1, "This server uses {94ED40}0Hide{FFFFFF} by {94ED40}Zh3r0{FFFFFF}. Type {94ED40}/hidehelp{FFFFFF} for more info.");
  174.  
  175. return 1;
  176. }
  177. public OnPlayerDisconnect(playerid, reason)
  178. {
  179. CurrentObject{playerid} = 0xFFFF;
  180. Activated{playerid} = false;
  181. }
  182.  
  183. public OnPlayerSpawn(playerid)
  184. {
  185. if(!GetPlayerColor(playerid))
  186. {
  187. SetPlayerColor(playerid, 0x94ED40FF);
  188. SendClientMessage(playerid, ~1, #lol);
  189. }
  190. return 1;
  191. }
  192. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  193. {
  194. switch(dialogid)
  195. {
  196. case Empty: return true;
  197. case List:
  198. {
  199. CurrentObject{playerid} = listitem;
  200.  
  201. new
  202. String[129];
  203.  
  204. format(String, sizeof(String), "You selected {94ED40}%s{FFFFFF} (Model: {94ED40}%d{FFFFFF}) as your cover. press {94ED40}C (Crouch)", ObjectInfo[listitem][o_n], ObjectInfo[listitem][o_id]);
  205. return SendClientMessage(playerid, ~1, String), true;
  206. }
  207. }
  208. return 0;
  209. }
  210. public OnPlayerCommandText(playerid, cmdtext[])
  211. {
  212. if(!strcmp(cmdtext, "/hideo"))
  213. {
  214. if(Activated{playerid})
  215. {
  216. new
  217. LongString[1_024];
  218.  
  219. for(new o = 0; o < sizeof(ObjectInfo); o++)
  220. {
  221. format(LongString, sizeof(LongString), "%s{94ED40} %s\n", LongString, ObjectInfo[o][o_n]);
  222. }
  223. ShowPlayerDialog
  224. (
  225. playerid,
  226. List,
  227. DIALOG_STYLE_LIST,
  228. "{94ED40}0Hide - Objects",
  229. LongString,
  230. "Select",
  231. "Close"
  232. );
  233. LongString[0] = EOS;
  234. }
  235.  
  236. else
  237. SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: {FFFFFF}Enable the {94ED40}Stealth Mode{FFFFFF} from {94ED40}/hide{FFFFFF}");
  238.  
  239. return 1;
  240. }
  241. if(!strcmp(cmdtext, "/hidehelp"))
  242. {
  243. ShowPlayerDialog
  244. (
  245. playerid,
  246. Empty,
  247. DIALOG_STYLE_MSGBOX,
  248. "{94ED40}0Hide - Stealthy",
  249. ShowContent(),
  250. "Close",
  251. ""
  252. );
  253. return 1;
  254. }
  255. if(!strcmp(cmdtext, "/hide"))
  256. {
  257. if(Activated{playerid})
  258. {
  259. SetPlayerColor(playerid, GetPlayerColor(playerid) + 0x000000FF);
  260. Activated{playerid} = false;
  261. SendClientMessage(playerid, ~1, "Hidding is now disabled");
  262. CurrentObject{playerid} = 0xFFFF;
  263. }
  264. else
  265. {
  266. Activated{playerid} = true;
  267. SendClientMessage(playerid, ~1, "Hidding is now enabled! Press {94ED40}C(Crouch){FFFFFF} to hide. Hold the key to stay stealthy.");
  268. SendClientMessage(playerid, ~1, "Use {94ED40}/hideo{FFFFFF} and choose your hiding object!");
  269. }
  270. return 1;
  271. }
  272. return 0;
  273. }
  274.  
  275.  
  276. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  277. {
  278. if(Activated{playerid})
  279. {
  280. if(!IsPlayerInAnyVehicle(playerid))
  281. {
  282. if(newkeys & KEY_CROUCH)
  283. {
  284. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK && !Hidden{playerid})
  285. {
  286. StealthMode(playerid);
  287. }
  288. else
  289. {
  290. RevealPlayer(playerid);
  291. }
  292. }
  293. if(Hidden{playerid})
  294. {
  295. if(PRESSED(KEY_JUMP | KEY_SPRINT | KEY_ACTION) || (!GetPlayerWeapon(playerid) && PRESSED(KEY_FIRE)))
  296. {
  297. RevealPlayer(playerid);
  298. }
  299. }
  300. }
  301. }
  302. return 1;
  303. }
  304. #if defined PERFECTION
  305. public OnPlayerUpdate(playerid)
  306. {
  307. if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK && Hidden{playerid})
  308. {
  309. RevealPlayer(playerid);
  310. }
  311. return 0;
  312. }
  313. #endif
Advertisement
Add Comment
Please, Sign In to add comment