Advertisement
ZumeZero

Sistema de selección de skin por click - FS SAMP

Jul 21st, 2013
2,078
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. // Selección de skin por Zume-Zero
  2.  
  3. #include <a_samp>
  4.  
  5. // Textdraws
  6. new Text:FlechaSkin1[MAX_PLAYERS];
  7. new Text:FlechaSkin2[MAX_PLAYERS];
  8. new Text:BarraNegra1;
  9. new Text:BarraNegra2;
  10. new Text:SkinIDInfo[MAX_PLAYERS];
  11.  
  12. // Otras Variables
  13. new Skin[MAX_PLAYERS];
  14. new PuedeCambiarSkin[MAX_PLAYERS];
  15. new SkinAntiguo[MAX_PLAYERS];
  16.  
  17. // Posiciones
  18. new Float:XANTES[MAX_PLAYERS],Float:YANTES[MAX_PLAYERS],Float:ZANTES[MAX_PLAYERS],Float:AANTES[MAX_PLAYERS];
  19. new InteriorAN[MAX_PLAYERS], VirtualWAN[MAX_PLAYERS];
  20.  
  21. public OnFilterScriptInit()
  22. {
  23. BarraNegra1 = TextDrawCreate(660.000000, -6.000000, "_");
  24. TextDrawBackgroundColor(BarraNegra1, 255);
  25. TextDrawFont(BarraNegra1, 1);
  26. TextDrawLetterSize(BarraNegra1, 0.500000, 12.100004);
  27. TextDrawColor(BarraNegra1, -1);
  28. TextDrawSetOutline(BarraNegra1, 0);
  29. TextDrawSetProportional(BarraNegra1, 1);
  30. TextDrawSetShadow(BarraNegra1, 1);
  31. TextDrawUseBox(BarraNegra1, 1);
  32. TextDrawBoxColor(BarraNegra1, 117);
  33. TextDrawTextSize(BarraNegra1, -20.000000, 0.000000);
  34. TextDrawSetSelectable(BarraNegra1, 0);
  35.  
  36. BarraNegra2 = TextDrawCreate(660.000000, 350.000000, "_");
  37. TextDrawBackgroundColor(BarraNegra2, 255);
  38. TextDrawFont(BarraNegra2, 1);
  39. TextDrawLetterSize(BarraNegra2, 0.500000, 11.000000);
  40. TextDrawColor(BarraNegra2, -1);
  41. TextDrawSetOutline(BarraNegra2, 0);
  42. TextDrawSetProportional(BarraNegra2, 1);
  43. TextDrawSetShadow(BarraNegra2, 1);
  44. TextDrawUseBox(BarraNegra2, 1);
  45. TextDrawBoxColor(BarraNegra2, 117);
  46. TextDrawTextSize(BarraNegra2, -20.000000, 0.000000);
  47. TextDrawSetSelectable(BarraNegra2, 0);
  48.  
  49. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++){
  50. Skin[playerid] = 0;
  51. CancelSelectTextDraw(playerid);
  52. FlechaSkin1[playerid] = TextDrawCreate(108.000000, 200.000000, "~<~");
  53. TextDrawBackgroundColor(FlechaSkin1[playerid], 255);
  54. TextDrawFont(FlechaSkin1[playerid], 1);
  55. TextDrawLetterSize(FlechaSkin1[playerid], 1.000000, 3.000000);
  56. TextDrawColor(FlechaSkin1[playerid], -1);
  57. TextDrawSetOutline(FlechaSkin1[playerid], 0);
  58. TextDrawSetProportional(FlechaSkin1[playerid], 1);
  59. TextDrawSetShadow(FlechaSkin1[playerid], 1);
  60. TextDrawSetSelectable(FlechaSkin1[playerid], 1);
  61.  
  62. FlechaSkin2[playerid] = TextDrawCreate(502.000000, 190.000000, "~>~");
  63. TextDrawBackgroundColor(FlechaSkin2[playerid], 255);
  64. TextDrawFont(FlechaSkin2[playerid], 1);
  65. TextDrawLetterSize(FlechaSkin2[playerid], 1.000000, 3.000000);
  66. TextDrawColor(FlechaSkin2[playerid], -1);
  67. TextDrawSetOutline(FlechaSkin2[playerid], 0);
  68. TextDrawSetProportional(FlechaSkin2[playerid], 1);
  69. TextDrawSetShadow(FlechaSkin2[playerid], 1);
  70. TextDrawSetSelectable(FlechaSkin2[playerid], 1);
  71.  
  72. SkinIDInfo[playerid] = TextDrawCreate(468.000000, 389.000000, "SKIN ID: 51");
  73. TextDrawBackgroundColor(SkinIDInfo[playerid], 255);
  74. TextDrawFont(SkinIDInfo[playerid], 3);
  75. TextDrawLetterSize(SkinIDInfo[playerid], 0.600000, 2.199999);
  76. TextDrawColor(SkinIDInfo[playerid], -1);
  77. TextDrawSetOutline(SkinIDInfo[playerid], 0);
  78. TextDrawSetProportional(SkinIDInfo[playerid], 1);
  79. TextDrawSetShadow(SkinIDInfo[playerid], 1);
  80. TextDrawSetSelectable(SkinIDInfo[playerid], 0);
  81.  
  82. }
  83. return 1;
  84. }
  85.  
  86. public OnPlayerConnect(playerid)
  87. {
  88. Skin[playerid] = 0;
  89. PuedeCambiarSkin[playerid] = 0;
  90. SkinAntiguo[playerid] = 0;
  91. return 1;
  92. }
  93.  
  94. public OnPlayerDisconnect(playerid, reason)
  95. {
  96. Skin[playerid] = 0;
  97. PuedeCambiarSkin[playerid] = 0;
  98. SkinAntiguo[playerid] = 0;
  99. return 1;
  100. }
  101.  
  102. public OnPlayerCommandText(playerid, cmdtext[])
  103. {
  104. if (strcmp("/skin", cmdtext, true, 10) == 0)
  105. {
  106. new string[190];
  107. GetPlayerPos(playerid,XANTES[playerid],YANTES[playerid],ZANTES[playerid]);
  108. GetPlayerFacingAngle(playerid,AANTES[playerid]);
  109. VirtualWAN[playerid] = GetPlayerVirtualWorld(playerid);
  110. InteriorAN[playerid] = GetPlayerInterior(playerid);
  111. SetPlayerVirtualWorld(playerid, playerid+7341);
  112.  
  113. SetPlayerCameraPos(playerid, 207.1526, -39.3834, 1002.8735);
  114. SetPlayerCameraLookAt(playerid, 207.5223, -38.4558, 1002.6689);
  115. SetPlayerPos(playerid,209.20, -34.24, 1001.93);
  116. SetPlayerFacingAngle(playerid, 180.0);
  117. SetPlayerInterior(playerid,1);
  118. Skin[playerid] = 1;
  119. PuedeCambiarSkin[playerid] = 1;
  120. SkinAntiguo[playerid] = GetPlayerSkin(playerid);
  121.  
  122. TextDrawShowForPlayer(playerid, FlechaSkin1[playerid]);
  123. TextDrawShowForPlayer(playerid, FlechaSkin2[playerid]);
  124. TextDrawShowForPlayer(playerid, BarraNegra1);
  125. TextDrawShowForPlayer(playerid, BarraNegra2);
  126. TextDrawShowForPlayer(playerid, SkinIDInfo[playerid]);
  127.  
  128. format(string, sizeof(string), "SKIN ID: %d", Skin[playerid]);
  129. TextDrawSetString(SkinIDInfo[playerid], string);
  130.  
  131. SelectTextDraw(playerid, 0xE60005FF);
  132. for(new i = 0; i < 10; i++){SendClientMessage(playerid, -1, "");}
  133.  
  134. SendClientMessage(playerid, -1,"{FFFF00}* TIP: {FFFFFF}Escribe {FFFF00}'/noquieroskin' {FFFFFF}para salir del catalogo de skins y no seleccionar el que tenías.");
  135. SendClientMessage(playerid, -1,"{FFFF00}* TIP: {FFFFFF}Escribe {FFFF00}'/quieroskin' {FFFFFF}para elegir el skin que tengas visto.");
  136. SendClientMessage(playerid, -1,"{FFFF00}* TIP: {FFFFFF}Presiona las flechas de {FFFF00}izquierda/derecha {FFFFFF}para mirar otros skins.");
  137. return 1;
  138. }
  139.  
  140. if (strcmp("/quieroskin", cmdtext, true, 10) == 0)
  141. {
  142. if(PuedeCambiarSkin[playerid] == 1)
  143. {
  144. SetPlayerPos(playerid,XANTES[playerid],YANTES[playerid],ZANTES[playerid]);
  145. SetPlayerFacingAngle(playerid, AANTES[playerid]);
  146. SetPlayerInterior(playerid,InteriorAN[playerid]);
  147. SetPlayerVirtualWorld(playerid,VirtualWAN[playerid]);
  148.  
  149. SetCameraBehindPlayer(playerid);
  150. TextDrawHideForPlayer(playerid, FlechaSkin1[playerid]);
  151. TextDrawHideForPlayer(playerid, FlechaSkin2[playerid]);
  152. TextDrawHideForPlayer(playerid, BarraNegra1);
  153. TextDrawHideForPlayer(playerid, BarraNegra2);
  154. TextDrawHideForPlayer(playerid, SkinIDInfo[playerid]);
  155.  
  156. CancelSelectTextDraw(playerid);
  157. CancelSelectTextDraw(playerid);
  158. SetPlayerSkin(playerid, Skin[playerid]);
  159. Skin[playerid] = 0;
  160. PuedeCambiarSkin[playerid] = 0;
  161. SkinAntiguo[playerid] = 0;
  162. SendClientMessage(playerid, -1, "{FFFF00}* ¡Felicidades!: {FFFFFF}Ahora tienes un nuevo skin puesto.");
  163. return 1;
  164. }
  165. }
  166. if (strcmp("/noquieroskin", cmdtext, true, 10) == 0)
  167. {
  168. if(PuedeCambiarSkin[playerid] == 1)
  169. {
  170. SetPlayerPos(playerid,XANTES[playerid],YANTES[playerid],ZANTES[playerid]);
  171. SetPlayerFacingAngle(playerid, AANTES[playerid]);
  172. SetPlayerInterior(playerid,InteriorAN[playerid]);
  173. SetPlayerVirtualWorld(playerid,VirtualWAN[playerid]);
  174.  
  175. SetCameraBehindPlayer(playerid);
  176. TextDrawHideForPlayer(playerid, FlechaSkin1[playerid]);
  177. TextDrawHideForPlayer(playerid, FlechaSkin2[playerid]);
  178. TextDrawHideForPlayer(playerid, BarraNegra1);
  179. TextDrawHideForPlayer(playerid, BarraNegra2);
  180. TextDrawHideForPlayer(playerid, SkinIDInfo[playerid]);
  181.  
  182. CancelSelectTextDraw(playerid);
  183. CancelSelectTextDraw(playerid);
  184. SetPlayerSkin(playerid,SkinAntiguo[playerid]);
  185. Skin[playerid] = 0;
  186. PuedeCambiarSkin[playerid] = 0;
  187. SkinAntiguo[playerid] = 0;
  188. SendClientMessage(playerid, -1, "{FFFF00}* Información: {FFFFFF}No cambiaste el skin y vuelves a tener el que antes tenías.");
  189. return 1;
  190. }
  191. }
  192. return 0;
  193. }
  194.  
  195. public OnPlayerClickTextDraw(playerid, Text:clickedid){
  196.  
  197. new string[120];
  198. if(clickedid == FlechaSkin1[playerid]){
  199. if(Skin[playerid] < 0){
  200. Skin[playerid] = 1;
  201. SendClientMessage(playerid, -1, "{FF0000}* Error: {FFFFFF}No puedes ir más atrás, no existen más, vuelve con la otra flecha");
  202. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  203. }
  204. Skin[playerid] --;
  205. SetPlayerSkin(playerid, Skin[playerid]);
  206.  
  207. format(string, sizeof(string), "SKIN ID: %d", Skin[playerid]);
  208. TextDrawSetString(SkinIDInfo[playerid], string);
  209.  
  210. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  211. }
  212. else if(clickedid == FlechaSkin2[playerid]){
  213. if(Skin[playerid] > 299){
  214. Skin[playerid] = 298;
  215. SendClientMessage(playerid, -1, "{FF0000}* Error: {FFFFFF}No puedes ir más adelante, no existen más, vuelve con la otra flecha");
  216. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  217. }
  218. Skin[playerid] ++;
  219. SetPlayerSkin(playerid, Skin[playerid]);
  220.  
  221. format(string, sizeof(string), "SKIN ID: %d", Skin[playerid]);
  222. TextDrawSetString(SkinIDInfo[playerid], string);
  223.  
  224. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  225. }
  226. return 1;
  227. }
  228.  
  229. // Selección de skin por Zume-Zero
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement