Guest User

dearh

a guest
Feb 13th, 2010
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.97 KB | None | 0 0
  1. //-------------------------------------------------
  2. //
  3. // Seifanimations - Perfect for role playing servers
  4. // Based on kyeman's vactions script
  5. //
  6. //-------------------------------------------------
  7.  
  8. #include <a_samp>
  9. #include <core>
  10. #include <float>
  11.  
  12. #define GREEN 0x21DD00FF
  13. #define RED 0xE60000FF
  14. #define ADMIN_RED 0xFB0000FF
  15. #define YELLOW 0xFFFF00FF
  16. #define ORANGE 0xF97804FF
  17. #define LIGHTRED 0xFF8080FF
  18. #define LIGHTBLUE 0x00C2ECFF
  19. #define PURPLE 0xB360FDFF
  20. #define PLAYER_COLOR 0xFFFFFFFF
  21. #define BLUE 0x1229FAFF
  22. #define LIGHTGREEN 0x38FF06FF
  23. #define DARKPINK 0xE100E1FF
  24. #define DARKGREEN 0x008040FF
  25. #define ANNOUNCEMENT 0x6AF7E1FF
  26. #define COLOR_SYSTEM 0xEFEFF7AA
  27. #define GREY 0xCECECEFF
  28. #define PINK 0xD52DFFFF
  29. #define DARKGREY 0x626262FF
  30. #define AQUAGREEN 0x03D687FF
  31. #define NICESKY 0x99FFFFAA
  32. #define WHITE 0xFFFFFFFF
  33.  
  34. #define SPECIAL_ACTION_PISSING 68
  35.  
  36. new gPlayerUsingLoopingAnim[MAX_PLAYERS];
  37. new gPlayerAnimLibsPreloaded[MAX_PLAYERS];
  38. new animation[200];
  39.  
  40. //-------------------------------------------------
  41.  
  42. // ********** INTERNAL FUNCTIONS **********
  43.  
  44. strtok(const string[], &index)
  45. {
  46. new length = strlen(string);
  47. while ((index < length) && (string[index] <= ' '))
  48. {
  49. index++;
  50. }
  51.  
  52. new offset = index;
  53. new result[20];
  54. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  55. {
  56. result[index - offset] = string[index];
  57. index++;
  58. }
  59. result[index - offset] = EOS;
  60. return result;
  61. }
  62.  
  63.  
  64. OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
  65. {
  66. if (gPlayerUsingLoopingAnim[playerid] == 1)
  67. ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
  68. animation[playerid]++;
  69. }
  70.  
  71. //-------------------------------------------------
  72.  
  73. LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
  74. {
  75. if (gPlayerUsingLoopingAnim[playerid] == 1)
  76. gPlayerUsingLoopingAnim[playerid] = 1;
  77. ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
  78. animation[playerid]++;
  79. }
  80.  
  81. //-------------------------------------------------
  82.  
  83. //-------------------------------------------------
  84.  
  85. PreloadAnimLib(playerid, animlib[])
  86. {
  87. ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
  88. }
  89.  
  90. //-------------------------------------------------
  91.  
  92. // ********** CALLBACKS **********
  93.  
  94. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  95. {
  96. if(!gPlayerUsingLoopingAnim[playerid]) return;
  97.  
  98. //SendClientInt(playerid, RED, "ID: %d", newkeys);
  99.  
  100. if((newkeys & KEY_SPRINT)) {
  101. animation[playerid] = 0;
  102. }
  103. }
  104.  
  105. //------------------------------------------------
  106. public OnPlayerDeath(playerid, killerid, reason)
  107. {
  108. // if they die whilst performing a looping anim, we should reset the state
  109. if(gPlayerUsingLoopingAnim[playerid]) {
  110. gPlayerUsingLoopingAnim[playerid] = 0;
  111. }
  112. return 1;
  113. }
  114. //-------------------------------------------------
  115.  
  116. public OnPlayerSpawn(playerid)
  117. {
  118. if(!gPlayerAnimLibsPreloaded[playerid]) {
  119. PreloadAnimLib(playerid,"BOMBER");
  120. PreloadAnimLib(playerid,"RAPPING");
  121. PreloadAnimLib(playerid,"SHOP");
  122. PreloadAnimLib(playerid,"BEACH");
  123. PreloadAnimLib(playerid,"SMOKING");
  124. PreloadAnimLib(playerid,"FOOD");
  125. PreloadAnimLib(playerid,"ON_LOOKERS");
  126. PreloadAnimLib(playerid,"DEALER");
  127. PreloadAnimLib(playerid,"CRACK");
  128. PreloadAnimLib(playerid,"CARRY");
  129. PreloadAnimLib(playerid,"COP_AMBIENT");
  130. PreloadAnimLib(playerid,"PARK");
  131. PreloadAnimLib(playerid,"INT_HOUSE");
  132. PreloadAnimLib(playerid,"FOOD");
  133. PreloadAnimLib(playerid,"PED");
  134. gPlayerAnimLibsPreloaded[playerid] = 1;
  135. }
  136. return 1;
  137. }
  138.  
  139. //-------------------------------------------------
  140.  
  141. public OnPlayerConnect(playerid)
  142. {
  143. gPlayerUsingLoopingAnim[playerid] = 0;
  144. gPlayerAnimLibsPreloaded[playerid] = 0;
  145. return 1;
  146. }
  147.  
  148. public OnPlayerCommandText(playerid, cmdtext[])
  149. {
  150. new cmd[256];
  151. new tmp[256];
  152. new idx;
  153. new dancestyle;
  154. cmd = strtok(cmdtext, idx);
  155.  
  156. if(strcmp(cmd,"/animlist",true)==0)
  157. {
  158. SendClientMessage(playerid, YELLOW, "___________________________________");
  159. SendClientMessage(playerid,RED,"Party Animations");
  160. SendClientMessage(playerid,WHITE,"/laugh - /crossarms - /lay - /wave");
  161. SendClientMessage(playerid,WHITE,"/slapass - /groundsit - /chat - /chairsit");
  162. SendClientMessage(playerid,WHITE,"/fall - /fallback - /kiss - /rap[1-4]");
  163. SendClientMessage(playerid,WHITE,"/tapcig - /lay2 - /lean - /strip[A-G]");
  164. SendClientMessage(playerid,WHITE,"/bedright - /bedleft - /dance[1-7]]");
  165. SendClientMessage(playerid, YELLOW, "�����������������������������������");
  166. return true;
  167. }
  168.  
  169. // Laugh
  170. if (strcmp("/laugh", cmdtext, true) == 0) {
  171. OnePlayAnim(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0); // Laugh
  172. return 1;
  173. }
  174. // Arms crossed
  175. if (strcmp("/crossarms", cmdtext, true) == 0) {
  176. LoopingAnim(playerid, "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1); // Arms crossed
  177. return 1;
  178. }
  179. // Lay Down
  180. if (strcmp("/lay", cmdtext, true) == 0) {
  181. LoopingAnim(playerid,"BEACH", "bather", 4.0, 1, 0, 0, 0, 0); // Lay down
  182. return 1;
  183. }
  184. // Wave
  185. if (strcmp("/wave", cmdtext, true) == 0) {
  186. LoopingAnim(playerid, "ON_LOOKERS", "wave_loop", 4.0, 1, 0, 0, 0, 0); // Wave
  187. return 1;
  188. }
  189. // Slap Ass
  190. if (strcmp("/slapass", cmdtext, true) == 0) {
  191. OnePlayAnim(playerid, "SWEET", "sweet_ass_slap", 4.0, 0, 0, 0, 0, 0); // Ass Slapping
  192. return 1;
  193. }
  194. // Sit
  195. if (strcmp("/groundsit", cmdtext, true) == 0 || strcmp("/gro", cmdtext, true) == 0) {
  196. LoopingAnim(playerid,"BEACH", "ParkSit_M_loop", 4.0, 1, 0, 0, 0, 0); // Sit
  197. return 1;
  198. }
  199. // Idle Chat
  200. if(strcmp(cmd, "/chat", true) == 0) {
  201. LoopingAnim(playerid,"PED","IDLE_CHAT",4.0,1,0,0,1,1);
  202. return 1;
  203. }
  204.  
  205. // ChairSit
  206. if(strcmp(cmd, "/chairsit", true) == 0) {
  207. LoopingAnim(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
  208. return 1;
  209. }
  210.  
  211. // Fall on the ground
  212. if(strcmp(cmd, "/fall", true) == 0) {
  213. LoopingAnim(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
  214. return 1;
  215. }
  216.  
  217. // Fall
  218. if(strcmp(cmd, "/fallback", true) == 0) {
  219. LoopingAnim(playerid, "PED","FLOOR_hit_f", 4.0, 1, 0, 0, 0, 0);
  220. return 1;
  221. }
  222.  
  223. // kiss
  224. if(strcmp(cmd, "/kiss", true) == 0) {
  225. LoopingAnim(playerid, "KISSING", "Playa_Kiss_02", 3.0, 1, 1, 1, 1, 0);
  226. return 1;
  227. }
  228.  
  229. // Rap animations
  230. if(strcmp(cmd, "/rap", true) == 0)
  231. {
  232. if (!strlen(cmdtext[5])) return SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /rap [1-4]");
  233. switch (cmdtext[5])
  234. {
  235. case '1': LoopingAnim(playerid,"RAPPING","RAP_A_Loop",4.0,1,0,0,0,0);
  236. case '2': LoopingAnim(playerid,"RAPPING","RAP_C_Loop",4.0,1,0,0,0,0);
  237. case '3': LoopingAnim(playerid,"GANGS","prtial_gngtlkD",4.0,1,0,0,0,0);
  238. case '4': LoopingAnim(playerid,"GANGS","prtial_gngtlkH",4.0,1,0,0,1,1);
  239. default: SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /rap [1-4]");
  240. }
  241. return 1;
  242. }
  243. // Tap cigarette
  244. if(strcmp(cmd, "/tapcig", true) == 0) {
  245. OnePlayAnim(playerid,"SMOKING","M_smk_tap",3.0,0,0,0,0,0);
  246. return 1;
  247. }
  248.  
  249. // Lay 2
  250. if(strcmp(cmd, "/lay2", true) == 0) {
  251. LoopingAnim(playerid,"SUNBATHE","Lay_Bac_in",3.0,0,1,1,1,0);
  252. return 1;
  253. }
  254.  
  255. // Leaning animation
  256. if(strcmp(cmd, "/lean", true) == 0)
  257. {
  258. if (!strlen(cmdtext[6])) return SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /lean [1-2]");
  259. switch (cmdtext[6])
  260. {
  261. case '1': LoopingAnim(playerid,"GANGS","leanIDLE",4.0,0,1,1,1,0);
  262. case '2': LoopingAnim(playerid,"MISC","Plyrlean_loop",4.0,0,1,1,1,0);
  263. default: SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /lean [1-2]");
  264. }
  265. return 1;
  266. }
  267. // Strip
  268. if(strcmp(cmd, "/strip", true) == 0)
  269. {
  270. if (!strlen(cmdtext[7])) return SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /strip [A-G]");
  271. switch (cmdtext[7])
  272. {
  273. case 'a', 'A': LoopingAnim(playerid,"STRIP", "strip_A", 4.1, 1, 1, 1, 1, 1 );
  274. case 'b', 'B': LoopingAnim(playerid,"STRIP", "strip_B", 4.1, 1, 1, 1, 1, 1 );
  275. case 'c', 'C': LoopingAnim(playerid,"STRIP", "strip_C", 4.1, 1, 1, 1, 1, 1 );
  276. case 'd', 'D': LoopingAnim(playerid,"STRIP", "strip_D", 4.1, 1, 1, 1, 1, 1 );
  277. case 'e', 'E': LoopingAnim(playerid,"STRIP", "strip_E", 4.1, 1, 1, 1, 1, 1 );
  278. case 'f', 'F': LoopingAnim(playerid,"STRIP", "strip_F", 4.1, 1, 1, 1, 1, 1 );
  279. case 'g', 'G': LoopingAnim(playerid,"STRIP", "strip_G", 4.1, 1, 1, 1, 1, 1 );
  280. default: SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /strip [A-G]");
  281. }
  282. return 1;
  283. }
  284.  
  285. // Bed Sleep R
  286. if(strcmp(cmd, "/bedright", true) == 0) {
  287. LoopingAnim(playerid,"INT_HOUSE","BED_Loop_R",4.0,1,0,0,0,0);
  288. return 1;
  289. }
  290. // Bed Sleep L
  291. if(strcmp(cmd, "/bedleft", true) == 0) {
  292. LoopingAnim(playerid,"INT_HOUSE","BED_Loop_L",4.0,1,0,0,0,0);
  293. return 1;
  294. }
  295.  
  296.  
  297. // START DANCING
  298. if(strcmp(cmd, "/dance", true) == 0) {
  299.  
  300. // Get the dance style param
  301. tmp = strtok(cmdtext, idx);
  302. if(!strlen(tmp)) {
  303. SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
  304. return 1;
  305. }
  306.  
  307. dancestyle = strval(tmp);
  308. if(dancestyle < 1 || dancestyle > 4) {
  309. SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
  310. return 1;
  311. }
  312.  
  313. if(dancestyle == 1) {
  314. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
  315. } else if(dancestyle == 2) {
  316. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2);
  317. } else if(dancestyle == 3) {
  318. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
  319. } else if(dancestyle == 4) {
  320. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4);
  321. }
  322. return 1;
  323. }
  324.  
  325. return 0;
  326. }
Advertisement
Add Comment
Please, Sign In to add comment