Badyx

Sistema de Ganzuas

Nov 22nd, 2011
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. Bueno esta vez vengo a dejarles el sistema de ganzuas que hice... EMPEZEMOS!
  2.  
  3. Lo primero sera ir a new PlayerInfo[MAX_PLAYERS][pInfo]; y definir pGanzua...
  4.  
  5. [pawn]enum pInfo
  6. {
  7. pGanzua,
  8. //demas cosas
  9. };
  10. new PlayerInfo[MAX_PLAYERS][pInfo];[/pawn]
  11.  
  12. Esto es para definir el pGanzua y no os diga undefinide simbol pGanzua
  13.  
  14. Luego buscamos public OnPlayerConnect(playerid) y volvemos a definir pGanzuas. Este paso es para que se guarden las ganzuas.
  15.  
  16. [pawn]public OnPlayerConnect(playerid)
  17. {
  18. PlayerInfo[playerid][pGanzua] = 0;
  19. //demas cosas[/pawn]
  20.  
  21. Luego en public OnPlayerRegister ponemos esto
  22.  
  23. [pawn]format(var, 64, "Ganzuas=%d\n",PlayerInfo[playerid][pGanzua]);fwrite(hFile, var);[/pawn]
  24.  
  25.  
  26. Mas abajo en public OnPlayerUpdate tendremos que volver a definirlo
  27.  
  28. [pawn]format(var, 64, "Ganzuas=%d\n",PlayerInfo[playerid][pGanzua]);fwrite(hFile, var);[/pawn]
  29.  
  30. Ahora buscaremos public OnPlayerLogin y aƱadimos esto
  31.  
  32. [pawn]if( strcmp( key , "Ganzuas" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGanzua] = strval( val ); }[/pawn]
  33.  
  34.  
  35. [color=#40BF40]EXPLICACION:[/color]
  36.  
  37. Todo lo que hemos echo hasta ahora es para definir las ganzuas y para que se guarden en las cuentas de usuarios.
  38.  
  39.  
  40. Bueno, ahora pasamos al comando /Puente
  41.  
  42. [spoiler][pawn]if (strcmp(cmd, "/Puente", true) == 0)
  43. {
  44. if(PlayerInfo[playerid][pGanzua] == 0)//esto es para definir si no tienen ganzuas
  45. {
  46. SendClientMessage(playerid, COLOR_GREY, " No tienes ganzuas para hacer un puente!");//este es el mensaje que saldra si no las tienen
  47. return 1;
  48. }
  49. if(!engineOn[GetPlayerVehicleID(playerid)])
  50. {
  51. if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
  52. {
  53. return 1;
  54. }
  55.  
  56. if(CarInfo[idcar][cOwned]==0)
  57. {
  58. SendClientMessage(playerid, COLOR_GRAD2, "No puedes robar vehiculos en venta!");
  59. return 1;
  60. }
  61. if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
  62. {
  63. return 1;
  64. }
  65. if(idcar == 59 || idcar == 60)
  66. {
  67. return 1;
  68. }
  69. if(idcar >= 135 && idcar <= 154)
  70. {
  71. return 1;
  72. }
  73. if(IsAPlane(idcar))
  74. {
  75. return 1;
  76. }
  77. if(IsAHarvest(idcar))
  78. {
  79. return 1;
  80. }
  81. if(IsADrugHarvest(idcar))
  82. {
  83. return 1;
  84. }
  85. if(IsASweeper(idcar))
  86. {
  87. return 1;
  88. }
  89. if(IsAGarbage(idcar))
  90. {
  91. return 1;
  92. }
  93. if(gEngine[playerid] == 1)
  94. {
  95. return 1;
  96. }
  97.  
  98. new playerveh = GetPlayerVehicleID(playerid);
  99. PutPlayerInVehicle(playerid, playerveh, 0);
  100. GetPlayerName(playerid, sendername, sizeof(sendername));
  101. format(string, sizeof(string), "* %s toma una ganzua del bolsillo", sendername);
  102. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  103. SetTimerEx("robovehiculo",3500,0,"i",playerid);
  104. GameTextForPlayer(playerid, "~w~Robando Vehiculo...",3500,3);
  105. PlayerInfo[playerid][pGanzua] -= 1;
  106. gEngine[playerid] = 1;
  107. }
  108. return 1;
  109. }[/pawn][/spoiler]
  110.  
  111. Aqui hay poca explicacion la verdad.....
  112.  
  113. [pawn]if(PlayerInfo[playerid][pGanzua] == 0)
  114. {
  115. SendClientMessage(playerid, COLOR_GREY, " No tienes ganzuas para hacer un puente!");
  116. return 1;
  117. }[/pawn]
  118.  
  119. Esto es para que si no tienes ganzuas logicamente no te deje hacer el puente xDD. Lo restante es lo mismo que el /motor.
  120.  
  121. Ahora crearemos el comando para que compren las ganzuas los mecanicos
  122.  
  123. [pawn]if(strcmp(cmdtext, "/comprarganzuas", true) == 0)
  124. {
  125. if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10)//faccion que puede usar el cmd
  126. {
  127. GivePlayerMoney(playerid, - 500);//dinero que te quita
  128. PlayerInfo[playerid][pGanzua] += 10;//cantidad de ganzuas que compras
  129. format(string, sizeof(string), "* %s Compra 10 Ganzuas", sendername);//Mensaje que te saldra
  130. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  131. }
  132. else
  133. {
  134. SendClientMessage(playerid, COLOR_GREY, "No eres Mecanico");//mensaje que saldra si no eres de la faccion
  135. }
  136. return 1;
  137. }[/pawn]
  138.  
  139. Y para terminar nos falta la segunda parte del /puente...
  140.  
  141. [spoiler][pawn]forward robovehiculo(playerid)
  142. public robovehiculo(playerid)
  143. {
  144. if(IsPlayerConnected(playerid))
  145. {
  146. if(IsPlayerInAnyVehicle(playerid))
  147. {
  148. new RandomStart;
  149. new string[256];
  150. new sendername[MAX_PLAYER_NAME];
  151. RandomStart = random(4);
  152. switch(RandomStart)
  153. {
  154. case 0,1,2:
  155. {
  156. engineOn[GetPlayerVehicleID(playerid)] = true;
  157. TogglePlayerControllable(playerid, true);
  158. GetPlayerName(playerid, sendername, sizeof(sendername));
  159. format(string, sizeof(string), "* %s Usa su ganzua e intenta encender el vehiculo y lo logra.", sendername);
  160. ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
  161. format(string, sizeof(string), "* %s Enciende el motor del vehiculo.", sendername);
  162. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  163. format(string, sizeof(string), "* %s Guarda su ganzua en el bolsillo.", sendername);
  164. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  165. gEngine[playerid] = 0;
  166. }
  167. case 3:
  168. {
  169. GetPlayerName(playerid, sendername, sizeof(sendername));
  170. format(string, sizeof(string), "* %s Usa su ganzua e intenta encender el vehiculo y Falla.", sendername);
  171. ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
  172. format(string, sizeof(string), "* %s Ha echo mucha fuerza y se ah roto la ganzua.", sendername);
  173. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  174. gEngine[playerid] = 0;
  175. Alambre[playerid] = 0;
  176. }
  177. }
  178. }
  179. else
  180. {
  181. gEngine[playerid] = 0;
  182. }
  183. }
  184. return 1;
  185. }[/pawn][/spoiler]
  186.  
  187. Aqui os dejo un comando para ver las ganzuas que teneis:
  188.  
  189. [pawn]if(strcmp(cmd, "/verganzuas", true) == 0)
  190. {
  191. if(IsPlayerConnected(playerid))
  192. {
  193. format(string, sizeof(string), " Usted tiene $%d ganzuas en su poder.",PlayerInfo[playerid][pGanzua]);
  194. SendClientMessage(playerid, COLOR_YELLOW, string);
  195. }
  196. return 1;
  197. }[/pawn]
  198.  
  199. Bueno esto seria algo improvisado pero si quereis que al poner /cuenta te salgan las ganzuas que tienes lo hacemos de esta manera
  200.  
  201. Vamos a ShowStats y ponemos esto
  202.  
  203. [pawn]new ganzuas = PlayerInfo[targetid][pGanzua];[/pawn]
  204.  
  205. Mas o menos asi
  206.  
  207. [pawn]public ShowStats(playerid,targetid)
  208. {
  209. if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
  210. {
  211. new ganzuas = PlayerInfo[targetid][pGanzua];[/pawn]
  212.  
  213. Esto sirve para definir ganzuas como pGanzua ya que con pGanzua nos daria error
  214.  
  215. Ahora vamos a donde tenemos todos los datos del /cuenta y aƱadimos esto
  216.  
  217. format(coordsstring, sizeof(coordsstring), " Ganzuas [%d]", ganzuas);
  218. SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
  219.  
  220. Y ya tendriamos todo
  221.  
  222. Bueno creo que no hay que explicar mucho mas pero si alguien necesita cualquier aclaracion que me avise y se lo explico
  223.  
  224. [color=#FF4000]Si vienes a criticar no pierdas tu tiempo posteando tonterias....[/color]
  225.  
  226. CREDITOS:
  227.  
  228. [spoiler]Todo para mi xD
  229. (Menos el /puente que como ya dije es el /motor modificado)[/spoiler]
  230.  
  231. Suerte :bien2:
  232.  
Advertisement
Add Comment
Please, Sign In to add comment