Advertisement
Guest User

p

a guest
Mar 11th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.58 KB | None | 0 0
  1. /*
  2. Minijogo de Paramédico
  3. por Jelly23
  4. */
  5. #define FILTERSCRIPT
  6.  
  7. /*Includes*/
  8. #include <a_samp>
  9. #include <izcmd>
  10. #include <foreach>
  11. #include <a_mysql>
  12.  
  13. /*TextDraw(s)*/
  14. static PlayerText:Info_Draws, //TextDraw branca (timer)
  15. PlayerText:Info_Draws2, //TextDraw Azul luz - informação como nível, etc...
  16.  
  17. /*Variaveis*/
  18. Assentos[MAX_PLAYERS], //Assentos na ambulancia
  19. Time[MAX_PLAYERS], //Duração do minijogo
  20. Equipamento[MAX_PLAYERS], //Equipamento (maca hospitalar)
  21. Minigame[MAX_PLAYERS], //1 se o jogador estiver no minijogo, se não 0
  22. Timer[MAX_PLAYERS], // Array para os timers por jogador
  23. Nivel[MAX_PLAYERS], // Nível do minigame que o jogador chegou
  24. AmbID[MAX_PLAYERS], // ID da ambulancia do jogador
  25. Salvos[MAX_PLAYERS], // Se tem algum paciente na maca hospitalar, caso contrario 0
  26. Atores[MAX_PLAYERS][12], //Atores por jogador, 1 por nível
  27. Ganhos[MAX_PLAYERS], //Ganhos totais por pacientes salvos
  28. NivelMax[MAX_PLAYERS], //Nivel maximo alcançado pelo jogador
  29. PessoasSalvas[MAX_PLAYERS], //Quantidade total de pessoas salvas pelo jogador
  30. minigamestatus = 1, //status do minijogo, 1 se ativado, 0 se desativado
  31. p1, //Ganhos por trazer um paciente para o hospital.
  32. p2, //Ganhos por trazer dois pacientes para o hospital.
  33. p3, //Ganhos por trazer três paciente para o hospital.
  34. final, //Ganho/Salário por finalizar o minijogo.
  35. nome[MAX_PLAYERS][MAX_PLAYER_NAME], //nome
  36. global[128]; //para algumas msgs.
  37.  
  38. /*Dialogo(s)*/
  39. #define DIALOG_OTHER (0)
  40. #define DIALOG_RCON (1)
  41. #define DIALOG_INFO (2)
  42. #define DIALOG_PARA (3)
  43. #define DIALOG_PAID (4)
  44. #define DIALOG_RCON2 (5)
  45. #define DIALOG_RCON3 (6)
  46. #define DIALOG_RCON4 (7)
  47. #define DIALOG_RCON5 (8)
  48. #define DIALOG_RCON6 (9)
  49. #define DIALOG_RCON7 (10)
  50. #define DIALOG_RCON8 (11)
  51.  
  52. /*MySQL*/
  53. #define MYSQL_HOST "localhost" //Mode o nome do host para o seu...
  54. #define MYSQL_USUARIO "root" //Mude o nome do usuário para o seu...
  55. #define MYSQL_DATABASE "minigame" //Mude o banco de dados / database para o seu...
  56. #define MYSQL_SENHA "" //Mude a senha para a sua...
  57. new mysql;
  58.  
  59. #if defined FILTERSCRIPT
  60.  
  61. public OnFilterScriptInit()
  62. {
  63. print("\n--------------------------------------");
  64. print(" Minijogo de Paramédico");
  65. print("--------------------------------------\n");
  66.  
  67. /*Criando os Veículos*/
  68. AddStaticVehicle(416,2036.9424,-1421.5847,17.1423,177.9331,1,3);
  69. AddStaticVehicle(416,2013.9448,-1416.6327,17.1410,268.2817,1,3);
  70.  
  71. /*Conexão MySQL*/
  72. mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
  73. mysql = mysql_connect(MYSQL_HOST, MYSQL_USUARIO, MYSQL_DATABASE, MYSQL_SENHA);
  74. if(mysql_errno(mysql) != 0)
  75. {
  76. print("Não foi possível conectar ao banco de dados!"); SendRconCommand("hostname ERRO DE MYSQL");
  77. }
  78. else
  79. {
  80. printf("Conectado ao banco de dados: %s",MYSQL_DATABASE);
  81. }
  82. mysql_tquery(mysql, "SELECT * FROM `config` LIMIT 1", "CarregarConfig", ""); //Carrega as configurações do minijogo.
  83. return 1;
  84. }
  85.  
  86. public OnFilterScriptExit()
  87. {
  88. mysql_format(mysql, global, sizeof(global), "UPDATE `config` SET `p1` ='%i' , `p2` = '%i', `p3`='%i', `final`='%i'",p1,p2,p3,final); //Query
  89. mysql_tquery(mysql, global, "", ""); //Salva a informação
  90. return 1;
  91. }
  92.  
  93. #else
  94.  
  95. main()
  96. {
  97. print("\n----------------------------------");
  98. print(" Minigame de Paramédico");
  99. print("----------------------------------\n");
  100. }
  101.  
  102. #endif
  103.  
  104. /*Callbacks*/
  105. public OnPlayerConnect(playerid)
  106. {
  107. /*Nome*/
  108. GetPlayerName(playerid,nome[playerid],24);
  109.  
  110. /*String*/
  111. new query[128];
  112.  
  113. /*Textdraw 1*/
  114. Info_Draws = CreatePlayerTextDraw(playerid, 429.324768, 119.366416, "TEMPO_RESTANTE___02:37");
  115. PlayerTextDrawLetterSize(playerid, Info_Draws, 0.400000, 1.600000);
  116. PlayerTextDrawAlignment(playerid, Info_Draws, 1);
  117. PlayerTextDrawColor(playerid, Info_Draws, -1);
  118. PlayerTextDrawSetShadow(playerid, Info_Draws, 0);
  119. PlayerTextDrawSetOutline(playerid, Info_Draws, 1);
  120. PlayerTextDrawBackgroundColor(playerid, Info_Draws, 255);
  121. PlayerTextDrawFont(playerid, Info_Draws, 2);
  122. PlayerTextDrawSetProportional(playerid, Info_Draws, 1);
  123. PlayerTextDrawSetShadow(playerid, Info_Draws, 0);
  124.  
  125. /*Textdraw 2*/
  126. Info_Draws2 = CreatePlayerTextDraw(playerid, 429.324768, 119.366416, "~n~_______nivel________12~n~~n~~n~assentos_livres______3");
  127. PlayerTextDrawLetterSize(playerid, Info_Draws2, 0.400000, 1.600000);
  128. PlayerTextDrawAlignment(playerid, Info_Draws2, 1);
  129. PlayerTextDrawColor(playerid, Info_Draws2, -1378294017);
  130. PlayerTextDrawSetShadow(playerid, Info_Draws2, 0);
  131. PlayerTextDrawSetOutline(playerid, Info_Draws2, 1);
  132. PlayerTextDrawBackgroundColor(playerid, Info_Draws2, 255);
  133. PlayerTextDrawFont(playerid, Info_Draws2, 2);
  134. PlayerTextDrawSetProportional(playerid, Info_Draws2, 1);
  135. PlayerTextDrawSetShadow(playerid, Info_Draws2, 0);
  136.  
  137. KillTimer(Timer[playerid]); //Mata o timer, para impedir conflitos
  138. Assentos[playerid] = 3; //Muda a quantia de assentos para 3 novamente.
  139. Minigame[playerid] = 0; //Minigame array mudada novamente para 0.
  140. Nivel[playerid] = 0; //Nível mudado para 0.
  141. Salvos[playerid] = 0; //Array salvos para 0, o que significa nenhum paciente
  142.  
  143. if(IsValidObject(Equipamento[playerid])) //Ve se o Equipamento (Maca hospitalar) é valido
  144. {
  145. DestroyObject(Equipamento[playerid]); //Se for valido, será destruido.
  146. }
  147.  
  148. mysql_format(mysql, query, sizeof(query),"SELECT * FROM `paramedicos` WHERE `nome` = '%e' LIMIT 1", nome[playerid]); //Query
  149. mysql_tquery(mysql, query, "LoadStuff", "i", playerid); //Carrega a informação relacionada com o minigame.
  150. return 1;
  151. }
  152.  
  153. forward LoadStuff(playerid);
  154. public LoadStuff(playerid)
  155. {
  156. new rows,fields,query[128];
  157. cache_get_data(rows, fields, mysql);
  158. if(rows)
  159. {
  160. Ganhos[playerid] = cache_get_field_content_int(0, "Ganhos");
  161. PessoasSalvas[playerid] = cache_get_field_content_int(0, "PessoasSalvas");
  162. NivelMax[playerid] = cache_get_field_content_int(0, "NivelMax");
  163. }
  164. else
  165. {
  166. mysql_format(mysql, query, sizeof(query), "INSERT INTO `paramedicos` (`nome`, `Ganhos`, `PessoasSalvas`, `NivelMax`) VALUES ('%e', 0, 0, 0)", nome[playerid]);
  167. mysql_tquery(mysql, query, "", "");
  168. }
  169. }
  170.  
  171. forward CarregarConfig();
  172. public CarregarConfig()
  173. {
  174. new rows,fields;
  175. cache_get_data(rows, fields, mysql);
  176. if(rows)
  177. {
  178. p1 = cache_get_field_content_int(0,"p1");
  179. p2 = cache_get_field_content_int(0,"p2");
  180. p3 = cache_get_field_content_int(0,"p3");
  181. final = cache_get_field_content_int(0,"final");
  182. }
  183. }
  184.  
  185. public OnPlayerDisconnect(playerid,reason)
  186. {
  187. new query[128];
  188. mysql_format(mysql, query, sizeof(query), "UPDATE `paramedicos` SET `Ganhos` ='%i' , `PessoasSalvas` = '%i', `NivelMax`='%i' WHERE `nome` ='%e'",Ganhos[playerid],PessoasSalvas[playerid],NivelMax[playerid],nome[playerid]); //Query
  189. mysql_tquery(mysql, query, "", "");
  190. SetVehicleVirtualWorld(AmbID[playerid], 0);
  191. }
  192.  
  193. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  194. {
  195. if(Salvos[playerid] == 1)
  196. {
  197. ClearAnimations(playerid);
  198. SendClientMessage(playerid,-1,"Não pode entrar na ambulancia sem colocar o paciente e equipamento dentro primeiro.");
  199. }
  200. return 1;
  201. }
  202.  
  203. public OnPlayerEnterCheckpoint(playerid)
  204. {
  205. if(Assentos[playerid] == 3) return 0;
  206. switch(Assentos[playerid])
  207. {
  208. case 2:
  209. {
  210. PessoasSalvas[playerid] += 1;
  211. Assentos[playerid] = 3;
  212. GiveMoney(playerid,p1);
  213. Time[playerid] += 20;
  214. format(global,sizeof(global),"Pacientes Salvos~n~~n~~n~~n~~w~+20 Segundos~n~~g~+$%i",p1);
  215. GameTextForPlayer(playerid, global, 5000, 3);
  216. }
  217. case 1:
  218. {
  219. PessoasSalvas[playerid] += 2;
  220. Assentos[playerid] = 3;
  221. GiveMoney(playerid,p2);
  222. Time[playerid] += 35;
  223. format(global,sizeof(global),"Pacientes Salvos~n~~n~~n~~n~~w~+35 Segundos~n~~g~+$%i",p2);
  224. GameTextForPlayer(playerid, global, 5000, 3);
  225. }
  226. case 0:
  227. {
  228. PessoasSalvas[playerid] += 3;
  229. Assentos[playerid] = 3;
  230. GiveMoney(playerid,p3);
  231. Time[playerid] += 45;
  232. format(global,sizeof(global),"Pacientes Salvos~n~~n~~n~~n~~w~+45 Segundos~n~~g~+$%i",p3);
  233. GameTextForPlayer(playerid, global, 5000, 3);
  234. }
  235. }
  236. new count;
  237. for(new i = 0; i < Nivel[playerid]; i++)
  238. {
  239. if(IsValidActor(Atores[playerid][i]))
  240. {
  241. count ++;
  242. }
  243. }
  244. if(count > 0) return 1;
  245. if(Nivel[playerid] < 12)
  246. {
  247. Nivel[playerid] ++;
  248. CriarVitima(playerid);
  249. if(NivelMax[playerid] < Nivel[playerid])
  250. {
  251. NivelMax[playerid] = Nivel[playerid];
  252. }
  253. }
  254. else
  255. {
  256. KillTimer(Timer[playerid]);
  257. GiveMoney(playerid,final);
  258. format(global,sizeof(global),"MISSAO DE PARAMEDICO ACABOU~n~~n~~n~~n~~g~+$%i",final);
  259. GameTextForPlayer(playerid, global, 5000, 3);
  260. Minigame[playerid] = 0;
  261. Nivel[playerid] = 0;
  262. PlayerTextDrawHide(playerid,Info_Draws);
  263. PlayerTextDrawHide(playerid,Info_Draws2);
  264. DisablePlayerCheckpoint(playerid);
  265. SetVehicleVirtualWorld(AmbID[playerid], 0);
  266. SetPlayerVirtualWorld(playerid, 0);
  267. }
  268. return 1;
  269. }
  270. public OnPlayerDeath(playerid,killerid,reason)
  271. {
  272. if(Minigame[playerid] == 1)
  273. {
  274. KillTimer(Timer[playerid]);
  275. for(new i = 0; i < Nivel[playerid]; i++)
  276. {
  277. DestroyActor(Atores[playerid][i]);
  278. RemovePlayerMapIcon(playerid, i);
  279. }
  280. if(IsValidObject(Equipamento[playerid]))
  281. {
  282. DestroyObject(Equipamento[playerid]);
  283. }
  284. Minigame[playerid] = 0;
  285. Nivel[playerid] = 0;
  286. GameTextForPlayer(playerid, "MISSAO DE PARAMEDICO~n~ACABOU", 5000, 3);
  287. PlayerTextDrawHide(playerid,Info_Draws);
  288. PlayerTextDrawHide(playerid,Info_Draws2);
  289. DisablePlayerCheckpoint(playerid);
  290. SetVehicleVirtualWorld(AmbID[playerid], 0);
  291. SetPlayerVirtualWorld(playerid, 0);
  292. }
  293. return 1;
  294. }
  295. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  296. {
  297. if ((newkeys & KEY_SUBMISSION))
  298. {
  299. if(IsPlayerInAnyVehicle(playerid))
  300. {
  301. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
  302. {
  303. if(minigamestatus == 1)
  304. {
  305. if(Minigame[playerid] == 0)
  306. {
  307. GameTextForPlayer(playerid, "PARAMEDICO", 5000, 3);
  308. Minigame[playerid] = 1;
  309. Time[playerid] = 210;
  310. Assentos[playerid] = 3;
  311. Nivel[playerid] = 1;
  312. Salvos[playerid] = 0;
  313. Timer[playerid] = SetTimerEx("MiniGame", 1000, true, "i", playerid);
  314. CriarVitima(playerid);
  315. AmbID[playerid] = GetPlayerVehicleID(playerid);
  316. SetPlayerCheckpoint(playerid, 2003.0234,-1444.5896,13.5619, 7.0);
  317. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), playerid+1);
  318. SetPlayerVirtualWorld(playerid, playerid+1);
  319. }
  320. else
  321. {
  322. KillTimer(Timer[playerid]);
  323. for(new i = 0; i < Nivel[playerid]; i++)
  324. {
  325. DestroyActor(Atores[playerid][i]);
  326. RemovePlayerMapIcon(playerid, i);
  327. }
  328. GameTextForPlayer(playerid, "MISSAO DE PARAMEDICO~n~ACABOU", 5000, 3);
  329. Minigame[playerid] = 0;
  330. Nivel[playerid] = 0;
  331. PlayerTextDrawHide(playerid,Info_Draws);
  332. PlayerTextDrawHide(playerid,Info_Draws2);
  333. DisablePlayerCheckpoint(playerid);
  334. SetVehicleVirtualWorld(AmbID[playerid], 0);
  335. SetPlayerVirtualWorld(playerid, 0);
  336. }
  337. }
  338. else
  339. {
  340. SendClientMessage(playerid,-1,"Minigame desativado.");
  341. }
  342. }
  343. }
  344. }
  345. return 1;
  346. }
  347.  
  348. public OnActorStreamIn(actorid, forplayerid)
  349. {
  350. ApplyActorAnimation(actorid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 0, 0);
  351. }
  352.  
  353. forward MiniGame(playerid);
  354. public MiniGame(playerid)
  355. {
  356. new str[128];
  357. if(Time[playerid] <= 0)
  358. {
  359. KillTimer(Timer[playerid]);
  360. for(new i = 0; i < Nivel[playerid]; i++)
  361. {
  362. DestroyActor(Atores[playerid][i]);
  363. RemovePlayerMapIcon(playerid, i);
  364. }
  365. if(IsValidObject(Equipamento[playerid]))
  366. {
  367. DestroyObject(Equipamento[playerid]);
  368. }
  369. Minigame[playerid] = 0;
  370. Nivel[playerid] = 0;
  371. GameTextForPlayer(playerid, "MISSAO DE PARAMEDICO~n~ACABOU", 5000, 3);
  372. PlayerTextDrawHide(playerid,Info_Draws);
  373. PlayerTextDrawHide(playerid,Info_Draws2);
  374. DisablePlayerCheckpoint(playerid);
  375. SetVehicleVirtualWorld(AmbID[playerid], 0);
  376. SetPlayerVirtualWorld(playerid, 0);
  377. }
  378. else
  379. {
  380. Time[playerid] --;
  381. format(str,sizeof(str),"TEMPO_RESTANTE___%s",TimeConvert(Time[playerid]));
  382. PlayerTextDrawSetString(playerid,Info_Draws,str);
  383. PlayerTextDrawShow(playerid,Info_Draws);
  384. format(str,sizeof(str),"~n~_______nivel________%i~n~~n~~n~Assentos_livres______%i",Nivel[playerid],Assentos[playerid]);
  385. PlayerTextDrawSetString(playerid,Info_Draws2,str);
  386. PlayerTextDrawShow(playerid,Info_Draws2);
  387. }
  388. return 1;
  389. }
  390.  
  391. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  392. {
  393. if(dialogid == DIALOG_INFO)
  394. {
  395. if(response)
  396. {
  397. switch(listitem)
  398. {
  399. case 0:
  400. {
  401. new paramedics[500];
  402. format(paramedics,sizeof(paramedics),"Nome\tNível\tAssentos Livres\tGanhos Totais\n");
  403. foreach(new i: Player)
  404. {
  405. if(Minigame[i] == 1)
  406. {
  407. format(paramedics,sizeof(paramedics),"{FFFFFF}%s%s\t%i\t%i\t{00FF00}$%i\n",paramedics,nome[i],Nivel[i],Assentos[i],Ganhos[i]);
  408. }
  409. }
  410. ShowPlayerDialog(playerid, DIALOG_PARA, DIALOG_STYLE_TABLIST_HEADERS,"Informação de Paramédico » {FFFFFF}Lista de Paramédicos",paramedics,"Voltar","Fechar");
  411. }
  412. case 1:
  413. {
  414. ShowPlayerDialog(playerid,DIALOG_PAID, DIALOG_STYLE_INPUT, "Informação de Paramédico » {FFFFFF}Estatísticas", "Entre o ID de um jogador abaixo:", "Confirmar", "Cancelar");
  415. }
  416. case 2:
  417. {
  418. new name[100],string[500];
  419. format(name,sizeof(name),"Informação de Paramédico » {FFFFFF}Estatísticas » %s",nome[playerid]);
  420. format(string,sizeof(string),"{FFFFFF}» Total Ganhos\t{00FF00}($%i)\n{FFFFFF}» People Saved\t(%i)\n{FFFFFF}» Max Level\t(%i)",Ganhos[playerid],PessoasSalvas[playerid],NivelMax[playerid]);
  421. ShowPlayerDialog(playerid, DIALOG_OTHER, DIALOG_STYLE_TABLIST, name, string, "Fechar", "");
  422. }
  423. }
  424. }
  425. }
  426. if(dialogid == DIALOG_PARA)
  427. {
  428. if(response)
  429. {
  430. new string[700];
  431. format(string,sizeof(string),"{FFFFFF}» Paramédicos {FF0000}(%i)\n{FFFFFF}» Estatísticas\n» Minhas Estatísticas",QuantidadeDeParamedicos());
  432. ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_LIST, "Informação de Paramédico",string, "Selecionar","Cancelar");
  433. }
  434. }
  435. if(dialogid == DIALOG_PAID)
  436. {
  437. if(response)
  438. {
  439. new name[100],string[500];
  440. format(name,sizeof(name),"Informação de Paramédico » {FFFFFF}Estatísticas » %s",nome[strval(inputtext)]);
  441. format(string,sizeof(string),"{FFFFFF}» Ganhos Totais\t{00FF00}($%i)\n{FFFFFF}» Pessoas Salvas\t(%i)\n{FFFFFF}» Nível Maximo\t(%i)",Ganhos[strval(inputtext)],PessoasSalvas[strval(inputtext)],NivelMax[strval(inputtext)]);
  442. ShowPlayerDialog(playerid, DIALOG_OTHER, DIALOG_STYLE_TABLIST, name, string, "Fechar", "");
  443. }
  444. }
  445. if(dialogid == DIALOG_RCON)
  446. {
  447. if(response)
  448. {
  449. switch(listitem)
  450. {
  451. case 0:
  452. {
  453. ShowPlayerDialog(playerid, DIALOG_RCON2, DIALOG_STYLE_LIST, "Minigame » {FFFFFF}Mudar Ganhos","{FFFFFF}» 1 Paciente\n» 2 Pacientes\n» 3 Pacientes\n» Ao finalizar o minigame.", "Selecionar","Cancelar");
  454. }
  455. case 1:
  456. {
  457. new Float:X,Float:Y,Float:Z,Float:R,x[30],y[30],z[30],r[30];
  458. GetPlayerPos(playerid,X,Y,Z),GetPlayerFacingAngle(playerid,R);
  459. format(x,sizeof(x),"%f",X),format(y,sizeof(y),"%f",Y);
  460. format(z,sizeof(z),"%f",Z),format(r,sizeof(r),"%f",R);
  461. mysql_format(mysql, global, sizeof(global), "INSERT INTO `Atores` (`ActorX`, `ActorY`, `ActorZ`, `ActorR`) VALUES ('%e', '%e', '%e', '%e')", x,y,z,r);
  462. mysql_tquery(mysql, global, "", "");
  463. SendClientMessage(playerid,-1,"Spawn de Ator criado na sua posição");
  464. }
  465. case 2:
  466. {
  467. ShowPlayerDialog(playerid,DIALOG_RCON7, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Ir para spawn de ator", "Entre o id do spawn de ator:", "Confirmar", "Cancelar");
  468. }
  469. case 3:
  470. {
  471. ShowPlayerDialog(playerid,DIALOG_RCON8, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Remover spawn de ator", "Entre o id do spawn de ator:", "Confirmar", "Cancelar");
  472. }
  473. case 4:
  474. {
  475. if(minigamestatus == 1)
  476. {
  477. minigamestatus = 0;
  478. SendClientMessage(playerid,-1,"Minigame desativado.");
  479. }
  480. else
  481. {
  482. minigamestatus = 1;
  483. SendClientMessage(playerid,-1,"Minigame ativado.");
  484. }
  485. }
  486. }
  487. }
  488. }
  489. if(dialogid == DIALOG_RCON2)
  490. {
  491. if(response)
  492. {
  493. switch(listitem)
  494. {
  495. case 0: ShowPlayerDialog(playerid,DIALOG_RCON3, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » 1 Pacientes", "Entre o valor abaixo:", "Confirmar", "Cancelar");
  496. case 1: ShowPlayerDialog(playerid,DIALOG_RCON4, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » 2 Pacientes", "Entre o valor abaixo:", "Confirmar", "Cancelar");
  497. case 2: ShowPlayerDialog(playerid,DIALOG_RCON5, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » 3 Pacientes", "Entre o valor abaixo:", "Confirmar", "Cancelar");
  498. case 3: ShowPlayerDialog(playerid,DIALOG_RCON6, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » Fim do Game", "Entre o valor abaixo:", "Confirmar", "Cancelar");
  499. }
  500. }
  501. }
  502. if(dialogid == DIALOG_RCON3)
  503. {
  504. if(response)
  505. {
  506. p1 = strval(inputtext);
  507. format(global,sizeof(global),"Ganhos por entregar 1 paciente mudados a '$%i'",p1);
  508. SendClientMessage(playerid,-1,global);
  509. }
  510. }
  511. if(dialogid == DIALOG_RCON4)
  512. {
  513. if(response)
  514. {
  515. p2 = strval(inputtext);
  516. format(global,sizeof(global),"Ganhos por entregar 2 pacientes mudados a '$%i'",p2);
  517. SendClientMessage(playerid,-1,global);
  518. }
  519. }
  520. if(dialogid == DIALOG_RCON5)
  521. {
  522. if(response)
  523. {
  524. p3 = strval(inputtext);
  525. format(global,sizeof(global),"Ganhos por entregar 3 pacientes mudados a '$%i'",p3);
  526. SendClientMessage(playerid,-1,global);
  527. }
  528. }
  529. if(dialogid == DIALOG_RCON6)
  530. {
  531. if(response)
  532. {
  533. final = strval(inputtext);
  534. format(global,sizeof(global),"Ganhos por terminar o minigame mudados a '$%i'",final);
  535. SendClientMessage(playerid,-1,global);
  536. }
  537. }
  538. if(dialogid == DIALOG_RCON7)
  539. {
  540. if(response)
  541. {
  542. mysql_format(mysql, global, sizeof(global),"SELECT * FROM `Atores` WHERE `aid` = '%i' LIMIT 1", strval(inputtext));
  543. mysql_tquery(mysql, global, "GotoActor", "i", playerid);
  544. }
  545. }
  546. if(dialogid == DIALOG_RCON8)
  547. {
  548. if(response)
  549. {
  550. mysql_format(mysql, global, sizeof(global),"DELETE FROM `Atores` WHERE `aid` = '%i' LIMIT 1",strval(inputtext));
  551. mysql_tquery(mysql, global,"","");
  552. format(global,sizeof(global),"Você removeu o spawn de ator id '%i'",strval(inputtext));
  553. SendClientMessage(playerid,-1,global);
  554. }
  555. }
  556. return 1;
  557. }
  558.  
  559. forward GotoActor(playerid);
  560. public GotoActor(playerid)
  561. {
  562. new rows,fields,x[30],y[30],z[30],r[30];
  563. cache_get_data(rows, fields, mysql);
  564. if(rows)
  565. {
  566. cache_get_field_content(0, "ActorX", x, mysql, 30);
  567. cache_get_field_content(0, "ActorY", y, mysql, 30);
  568. cache_get_field_content(0, "ActorZ", z, mysql, 30);
  569. cache_get_field_content(0, "ActorR", r, mysql, 30);
  570. SetPlayerPos(playerid,floatstr(x),floatstr(y),floatstr(z));
  571. SetPlayerFacingAngle(playerid,floatstr(r));
  572. }
  573. else
  574. {
  575. SendClientMessage(playerid,-1,"Spawn ID Invalido.");
  576. }
  577. }
  578.  
  579. /*Funções*/
  580. SkinsAleatorios()
  581. {
  582. new skinid;
  583. switch(random(7))
  584. {
  585. case 0: skinid = 280;
  586. case 1: skinid = 165;
  587. case 2: skinid = 76;
  588. case 3: skinid = 166;
  589. case 4: skinid = 168;
  590. case 5: skinid = 185;
  591. case 6: skinid = 188;
  592. }
  593. return skinid;
  594. }
  595.  
  596. CriarVitima(playerid)
  597. {
  598. mysql_format(mysql, global, sizeof(global), "SELECT * FROM `Atores` ORDER BY RAND() LIMIT %i",Nivel[playerid]);
  599. mysql_tquery(mysql, global, "CriarAtores", "i",playerid);
  600. }
  601.  
  602. forward CriarAtores(playerid);
  603. public CriarAtores(playerid)
  604. {
  605. new Aztores = cache_get_row_count(),x[30],y[30],z[30],r[30];
  606. for(new i = 0; i < Aztores; i++)
  607. {
  608. cache_get_field_content(i, "ActorX", x, mysql, 30);
  609. cache_get_field_content(i, "ActorY", y, mysql, 30);
  610. cache_get_field_content(i, "ActorZ", z, mysql, 30);
  611. cache_get_field_content(i, "ActorR", r, mysql, 30);
  612. Atores[playerid][i] = CreateActor(SkinsAleatorios(), floatstr(x), floatstr(y), floatstr(z), floatstr(r));
  613. SetPlayerMapIcon(playerid, i, floatstr(x), floatstr(y), floatstr(z), 0, 0x0000BBAA, MAPICON_GLOBAL);
  614. ApplyActorAnimation(Atores[playerid][i], "CRACK", "crckdeth2", 4.1, 0, 0, 0, 0, 0);
  615. SetActorVirtualWorld(Atores[playerid][i], playerid+1);
  616. }
  617. }
  618.  
  619. TimeConvert(time)
  620. {
  621. new minutes;
  622. new seconds;
  623. new string[10];
  624. if(time > 59)
  625. {
  626. minutes = floatround(time / 60);
  627. seconds = floatround(time - minutes*60);
  628. if(seconds > 9)format(string,sizeof(string),"%d:%d",minutes,seconds);
  629. else format(string,sizeof(string),"%d:0%d",minutes,seconds);
  630. }
  631. else
  632. {
  633. seconds = floatround(time);
  634. if(seconds > 9)format(string,sizeof(string),"0:%d",seconds);
  635. else format(string,sizeof(string),"0:0%d",seconds);
  636. }
  637. return string;
  638. }
  639.  
  640. GiveMoney(playerid,money)
  641. {
  642. Ganhos[playerid] += money;
  643. GivePlayerMoney(playerid,money);
  644. }
  645.  
  646. QuantidadeDeParamedicos()
  647. {
  648. new count=0;
  649. foreach(new p: Player)
  650. {
  651. if(Minigame[p] == 1) count++;
  652. }
  653. return count;
  654. }
  655.  
  656. /*Commands*/
  657. CMD:salvar(playerid)
  658. {
  659. if(!IsValidObject(Equipamento[playerid])) return SendClientMessage(playerid,-1,"Va proximo da ambulancia e pegue seu equipamento primeiro (/maca)");
  660. if(Salvos[playerid] == 1) return SendClientMessage(playerid,-1,"Tem um paciente com você, coloque o primeiramente na ambulancia (/maca)");
  661. new Float:x,Float:y,Float:z;
  662. for(new i = 0; i < Nivel[playerid]; i++)
  663. {
  664. GetActorPos(Atores[playerid][i], x, y, z);
  665. if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
  666. {
  667. RemovePlayerMapIcon(playerid, i);
  668. DestroyActor(Atores[playerid][i]);
  669. Salvos[playerid] = 1;
  670. SendClientMessage(playerid,-1,"Va proximo da ambulancia e use /maca para colocar o paciente e equipamento dentro.");
  671. }
  672. }
  673. return 1;
  674. }
  675.  
  676. CMD:maca(playerid)
  677. {
  678. if(Minigame[playerid] == 0) return SendClientMessage(playerid,-1,"Nao esta no minigame de Paramédico");
  679. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Deve sair de seu veiculo primeiro...");
  680. if(Assentos[playerid] == 0) return SendClientMessage(playerid,-1,"Nenhum assento livre, deixe os pacientes no hospital primeiro.");
  681. new Float:x,Float:y,Float:z;
  682. GetVehiclePos(AmbID[playerid],x,y,z);
  683. if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
  684. {
  685. if(!IsValidObject(Equipamento[playerid]))
  686. {
  687. Equipamento[playerid] = CreateObject(2146, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  688. AttachObjectToPlayer(Equipamento[playerid], playerid, -0.050000, 1.518999, -0.500000, 2.200002, -0.500136, 0.000000);
  689. }
  690. else
  691. {
  692. DestroyObject(Equipamento[playerid]);
  693. if(Salvos[playerid] == 1)
  694. {
  695. Assentos[playerid] --;
  696. Salvos[playerid] = 0;
  697. Time[playerid] += 25;
  698. GameTextForPlayer(playerid, "Salvos!~n~~n~~n~~n~~w~+25 Segundos", 5000, 3);
  699. }
  700. }
  701. }
  702. else
  703. {
  704. SendClientMessage(playerid,-1,"Deve estar proximo da ambulancia para pegar/guardar seu equipamento.");
  705. }
  706. return 1;
  707. }
  708.  
  709. CMD:pinfo(playerid)
  710. {
  711. new string[700];
  712. format(string,sizeof(string),"{FFFFFF}» Paramédicos {FF0000}(%i)\n{FFFFFF}» Estatisticas\n{FFFFFF}» Minhas Estatisticas",QuantidadeDeParamedicos());
  713. ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_LIST, "Informação de Paramédico",string, "Selecionar","Cancelar");
  714. return 1;
  715. }
  716.  
  717. CMD:minigame(playerid)
  718. {
  719. if(IsPlayerAdmin(playerid))
  720. {
  721. if(minigamestatus == 1)
  722. {
  723. ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_LIST, "Minigame","{FFFFFF}» Mudar Ganhos\n» Criar Spawn de ator\n» Ir para spawn de ator\n» Remover spawn de ator\n» Ativar/Desativar minijogo {00FF00}(Ativado)", "Selecionar","Cancelar");
  724. }
  725. else
  726. {
  727. ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_LIST, "Minigame","{FFFFFF}» Mudar Ganhos\n» Criar Spawn de ator\n» Ir para spawn de ato\n» Remover spawn de ator\n» Ativar/Desativar minijogo {FF0000}(Desativado)", "Selecionar","Cancelar");
  728. }
  729. }
  730. return 1;
  731. }
  732.  
  733. CMD:test(playerid)
  734. {
  735. if(IsPlayerAdmin(playerid))
  736. {
  737. SetPlayerPos(playerid,2019.1501,-1420.2346,16.9922);
  738. }
  739. return 1;
  740. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement