Guest User

Untitled

a guest
Mar 26th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.40 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #define COLOR_GREY 0xAFAFAFAA
  7. #define COLOR_LIGHTBLUE 0x33CCFFAA
  8. #define COLOR_WHITE 0xFFFFFFAA
  9. #pragma tabsize 0
  10. #define TOUR_SHAKE 500
  11. new ShakeOffer[MAX_PLAYERS];
  12.  
  13. stock warpmsg(playerid, col, string[])
  14. {
  15. new end1[256], end2[256], end3[256];
  16. if(strlen(string) > 90)
  17. {
  18. format(end1, sizeof(end1), string);
  19. format(end2, sizeof(end2), string);
  20. strdel(end1, 90, 256);
  21. strdel(end2, 0, 90);
  22. format(end3, sizeof(end3), "%s ...", end1);
  23. SendClientMessage(playerid, col, end3);
  24. format(end3, sizeof(end3), "... %s", end2);
  25. SendClientMessage(playerid, col, end3);
  26. }
  27. else
  28. {
  29. SendClientMessage(playerid, col, string);
  30. }
  31. }
  32.  
  33.  
  34.  
  35. strtok(const string[], &index)
  36. {
  37. new length = strlen(string);
  38. while ((index < length) && (string[index] <= ' '))
  39. {
  40. index++;
  41. }
  42.  
  43. new offset = index;
  44. new result[20];
  45. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  46. {
  47. result[index - offset] = string[index];
  48. index++;
  49. }
  50. result[index - offset] = EOS;
  51. return result;
  52. }
  53.  
  54.  
  55. public OnPlayerCommandText(playerid, cmdtext[])
  56. {
  57. new tmp[256];
  58. new cmd[256];
  59. new idx;
  60. cmd = strtok(cmdtext, idx);
  61. new giveplayer[MAX_PLAYER_NAME];
  62. new sendername[MAX_PLAYER_NAME];
  63. new number[256];
  64.  
  65. if(strcmp(cmd,"/shake",true)==0)
  66. {
  67. if(IsPlayerConnected(playerid))
  68. {
  69. tmp = strtok(cmdtext, idx);
  70. if(!strlen(tmp))
  71. {
  72. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /shake [playerid/PartOfName]");
  73. return 1;
  74. }
  75. new giveplayerid;
  76. giveplayerid = strval(tmp);
  77. if (IsPlayerConnected(giveplayerid))
  78. {
  79. if(giveplayerid != INVALID_PLAYER_ID)
  80. {
  81. if (ProxDetectorS(8.0, playerid, giveplayerid))
  82. {
  83. if(giveplayerid == playerid)
  84. {
  85. SendClientMessage(playerid, COLOR_GREY, " You can't handshake yourself");
  86. return 1;
  87. }
  88. new string[256];
  89. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  90. GetPlayerName(playerid, sendername, sizeof(sendername));
  91. format(string, sizeof(string), "* You offered %s a handshake .", giveplayer);
  92. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  93. format(string, sizeof(string), "* %s is offering you a handshake, (type /accept shake[1-7]).", sendername);
  94. SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  95. ShakeOffer[giveplayerid] = playerid;
  96. }
  97. else
  98. {
  99. SendClientMessage(playerid, COLOR_GREY, " That player is not near you!");
  100. }
  101. }
  102. }
  103. else
  104. {
  105. SendClientMessage(playerid, COLOR_GREY, " Invalid ID/Name!");
  106. return 1;
  107. }
  108. }
  109. return 1;
  110. }
  111.  
  112. if(strcmp(cmd,"/accept",true)==0)
  113. {
  114.  
  115. number = strtok(cmdtext, idx);
  116.  
  117. if(!strlen(number)) {
  118. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /accept [name]");
  119. SendClientMessage(playerid, COLOR_GREY, "Available names: Shake(1-7)");
  120. return 1;
  121. }
  122. if(strcmp(number,"shake",true) == 0)
  123. {
  124. if(ShakeOffer[playerid] < TOUR_SHAKE)
  125. {
  126. if(IsPlayerConnected(ShakeOffer[playerid]))
  127. {
  128. new string[256];
  129. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  130. GetPlayerName(playerid, sendername, sizeof(sendername));
  131. format(string, sizeof(string), "* You have accepted the handshake.");
  132. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  133. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  134. ApplyAnimation(playerid,"GANGS","hndshkfa_swt",4.0,0,0,0,0,0);
  135. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkfa_swt",4.0,0,0,0,0,0);
  136. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  137. ShakeOffer[playerid] = TOUR_SHAKE;
  138. return 1;
  139. }
  140. else
  141. {
  142. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  143. return 1;
  144. }
  145. }
  146. }
  147. else if(strcmp(number,"shake1",true) == 0)
  148. {
  149. if(ShakeOffer[playerid] < TOUR_SHAKE)
  150. {
  151. if(IsPlayerConnected(ShakeOffer[playerid]))
  152. {
  153. new string[256];
  154. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  155. GetPlayerName(playerid, sendername, sizeof(sendername));
  156. format(string, sizeof(string), "* You have accepted the handshake.");
  157. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  158. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  159. ApplyAnimation(playerid,"GANGS","hndshkaa",4.0,0,0,0,0,0);
  160. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkaa",4.0,0,0,0,0,0);
  161. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  162. ShakeOffer[playerid] = TOUR_SHAKE;
  163. return 1;
  164. }
  165. else
  166. {
  167. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  168. return 1;
  169. }
  170. }
  171. }
  172. else if(strcmp(number,"shake2",true) == 0)
  173. {
  174. if(ShakeOffer[playerid] < TOUR_SHAKE)
  175. {
  176. if(IsPlayerConnected(ShakeOffer[playerid]))
  177. {
  178. new string[256];
  179. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  180. GetPlayerName(playerid, sendername, sizeof(sendername));
  181. format(string, sizeof(string), "* You have accepted the handshake.");
  182. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  183. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  184. ApplyAnimation(playerid,"GANGS","hndshkba",4.0,0,0,0,0,0);
  185. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkba",4.0,0,0,0,0,0);
  186. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  187. ShakeOffer[playerid] = TOUR_SHAKE;
  188. return 1;
  189. }
  190. else
  191. {
  192. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  193. return 1;
  194. }
  195. }
  196. }
  197. else if(strcmp(number,"shake3",true) == 0)
  198. {
  199. if(ShakeOffer[playerid] < TOUR_SHAKE)
  200. {
  201. if(IsPlayerConnected(ShakeOffer[playerid]))
  202. {
  203. new string[256];
  204. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  205. GetPlayerName(playerid, sendername, sizeof(sendername));
  206. format(string, sizeof(string), "* You have accepted the handshake.");
  207. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  208. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  209. ApplyAnimation(playerid,"GANGS","hndshkca",4.0,0,0,0,0,0);
  210. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkca",4.0,0,0,0,0,0);
  211. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  212. ShakeOffer[playerid] = TOUR_SHAKE;
  213. return 1;
  214. }
  215. else
  216. {
  217. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  218. return 1;
  219. }
  220. }
  221. }
  222. else if(strcmp(number,"shake4",true) == 0)
  223. {
  224. if(ShakeOffer[playerid] < TOUR_SHAKE)
  225. {
  226. if(IsPlayerConnected(ShakeOffer[playerid]))
  227. {
  228. new string[256];
  229. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  230. GetPlayerName(playerid, sendername, sizeof(sendername));
  231. format(string, sizeof(string), "* You have accepted the handshake.");
  232. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  233. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  234. ApplyAnimation(playerid,"GANGS","hndshkcb",4.0,0,0,0,0,0);
  235. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkcb",4.0,0,0,0,0,0);
  236. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  237. ShakeOffer[playerid] = TOUR_SHAKE;
  238. return 1;
  239. }
  240. else
  241. {
  242. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  243. return 1;
  244. }
  245. }
  246. }
  247. else if(strcmp(number,"shake5",true) == 0)
  248. {
  249. if(ShakeOffer[playerid] < TOUR_SHAKE)
  250. {
  251. if(IsPlayerConnected(ShakeOffer[playerid]))
  252. {
  253. new string[256];
  254. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  255. GetPlayerName(playerid, sendername, sizeof(sendername));
  256. format(string, sizeof(string), "* You have accepted the handshake.");
  257. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  258. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  259. ApplyAnimation(playerid,"GANGS","hndshkda",4.0,0,0,0,0,0);
  260. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkda",4.0,0,0,0,0,0);
  261. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  262. ShakeOffer[playerid] = TOUR_SHAKE;
  263. return 1;
  264. }
  265. else
  266. {
  267. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  268. return 1;
  269. }
  270. }
  271. }
  272. else if(strcmp(number,"shake6",true) == 0)
  273. {
  274. if(ShakeOffer[playerid] < TOUR_SHAKE)
  275. {
  276. if(IsPlayerConnected(ShakeOffer[playerid]))
  277. {
  278. new string[256];
  279. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  280. GetPlayerName(playerid, sendername, sizeof(sendername));
  281. format(string, sizeof(string), "* You have accepted the handshake.");
  282. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  283. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  284. ApplyAnimation(playerid,"GANGS","hndshkea",4.0,0,0,0,0,0);
  285. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkea",4.0,0,0,0,0,0);
  286. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  287. ShakeOffer[playerid] = TOUR_SHAKE;
  288. return 1;
  289. }
  290. else
  291. {
  292. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  293. return 1;
  294. }
  295. }
  296. }
  297. else if(strcmp(number,"shake7",true) == 0)
  298. {
  299. if(ShakeOffer[playerid] < TOUR_SHAKE)
  300. {
  301. if(IsPlayerConnected(ShakeOffer[playerid]))
  302. {
  303. new string[256];
  304. GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
  305. GetPlayerName(playerid, sendername, sizeof(sendername));
  306. format(string, sizeof(string), "* You have accepted the handshake.");
  307. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  308. format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
  309. ApplyAnimation(playerid,"GANGS","hndshkfa",4.0,0,0,0,0,0);
  310. ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkfa",4.0,0,0,0,0,0);
  311. SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
  312. ShakeOffer[playerid] = TOUR_SHAKE;
  313. return 1;
  314. }
  315. else
  316. {
  317. SendClientMessage(playerid, COLOR_GREY, " No-one has offered a handshake...");
  318. return 1;
  319. }
  320. }
  321. }
  322. }
  323. return 0;
  324. }
  325.  
  326.  
  327.  
  328. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  329. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  330. {
  331. if(IsPlayerConnected(playerid))
  332. {
  333. new Float:posx, Float:posy, Float:posz;
  334. new Float:oldposx, Float:oldposy, Float:oldposz;
  335. new Float:tempposx, Float:tempposy, Float:tempposz;
  336. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  337. new VW = GetPlayerVirtualWorld(playerid);
  338. //radi = 2.0; //Trigger Radius
  339. for(new i = 0; i < MAX_PLAYERS; i++)
  340. {
  341. if(IsPlayerConnected(i))
  342. {
  343. GetPlayerPos(i, posx, posy, posz);
  344. tempposx = (oldposx -posx);
  345. tempposy = (oldposy -posy);
  346. tempposz = (oldposz -posz);
  347. //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  348. if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  349. {
  350. warpmsg(i, col1,string);
  351. }
  352. else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  353. {
  354. warpmsg(i, col2,string);
  355.  
  356. }
  357. else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  358. {
  359. warpmsg(i, col3,string);
  360.  
  361. }
  362. else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  363. {
  364. warpmsg(i, col4,string);
  365.  
  366. }
  367. else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  368. {
  369. warpmsg(i, col5,string);
  370.  
  371. }
  372. }
  373. }
  374. }//not connected
  375. return 1;
  376. }
  377.  
  378. forward ProxDetectorS(Float:radi, playerid, targetid);
  379. public ProxDetectorS(Float:radi, playerid, targetid)
  380. {
  381. //if (gdebug >= 3){//printf("DEBUG ProxDetectorS()");}
  382. new Float:posx, Float:posy, Float:posz;
  383. new Float:oldposx, Float:oldposy, Float:oldposz;
  384. new Float:tempposx, Float:tempposy, Float:tempposz;
  385. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  386. //radi = 2.0; //Trigger Radius
  387. GetPlayerPos(targetid, posx, posy, posz);
  388. tempposx = (oldposx -posx);
  389. tempposy = (oldposy -posy);
  390. tempposz = (oldposz -posz);
  391. ////printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  392. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  393. {
  394. return 1;
  395. }
  396. return 0;
  397. }
Advertisement
Add Comment
Please, Sign In to add comment