Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Minijogo de Paramédico
- por Jelly23
- */
- #define FILTERSCRIPT
- /*Includes*/
- #include <a_samp>
- #include <izcmd>
- #include <foreach>
- #include <a_mysql>
- /*TextDraw(s)*/
- static PlayerText:Info_Draws, //TextDraw branca (timer)
- PlayerText:Info_Draws2, //TextDraw Azul luz - informação como nível, etc...
- /*Variaveis*/
- Assentos[MAX_PLAYERS], //Assentos na ambulancia
- Time[MAX_PLAYERS], //Duração do minijogo
- Equipamento[MAX_PLAYERS], //Equipamento (maca hospitalar)
- Minigame[MAX_PLAYERS], //1 se o jogador estiver no minijogo, se não 0
- Timer[MAX_PLAYERS], // Array para os timers por jogador
- Nivel[MAX_PLAYERS], // Nível do minigame que o jogador chegou
- AmbID[MAX_PLAYERS], // ID da ambulancia do jogador
- Salvos[MAX_PLAYERS], // Se tem algum paciente na maca hospitalar, caso contrario 0
- Atores[MAX_PLAYERS][12], //Atores por jogador, 1 por nível
- Ganhos[MAX_PLAYERS], //Ganhos totais por pacientes salvos
- NivelMax[MAX_PLAYERS], //Nivel maximo alcançado pelo jogador
- PessoasSalvas[MAX_PLAYERS], //Quantidade total de pessoas salvas pelo jogador
- minigamestatus = 1, //status do minijogo, 1 se ativado, 0 se desativado
- p1, //Ganhos por trazer um paciente para o hospital.
- p2, //Ganhos por trazer dois pacientes para o hospital.
- p3, //Ganhos por trazer três paciente para o hospital.
- final, //Ganho/Salário por finalizar o minijogo.
- nome[MAX_PLAYERS][MAX_PLAYER_NAME], //nome
- global[128]; //para algumas msgs.
- /*Dialogo(s)*/
- #define DIALOG_OTHER (0)
- #define DIALOG_RCON (1)
- #define DIALOG_INFO (2)
- #define DIALOG_PARA (3)
- #define DIALOG_PAID (4)
- #define DIALOG_RCON2 (5)
- #define DIALOG_RCON3 (6)
- #define DIALOG_RCON4 (7)
- #define DIALOG_RCON5 (8)
- #define DIALOG_RCON6 (9)
- #define DIALOG_RCON7 (10)
- #define DIALOG_RCON8 (11)
- /*MySQL*/
- #define MYSQL_HOST "localhost" //Mode o nome do host para o seu...
- #define MYSQL_USUARIO "root" //Mude o nome do usuário para o seu...
- #define MYSQL_DATABASE "minigame" //Mude o banco de dados / database para o seu...
- #define MYSQL_SENHA "" //Mude a senha para a sua...
- new mysql;
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Minijogo de Paramédico");
- print("--------------------------------------\n");
- /*Criando os Veículos*/
- AddStaticVehicle(416,2036.9424,-1421.5847,17.1423,177.9331,1,3);
- AddStaticVehicle(416,2013.9448,-1416.6327,17.1410,268.2817,1,3);
- /*Conexão MySQL*/
- mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
- mysql = mysql_connect(MYSQL_HOST, MYSQL_USUARIO, MYSQL_DATABASE, MYSQL_SENHA);
- if(mysql_errno(mysql) != 0)
- {
- print("Não foi possível conectar ao banco de dados!"); SendRconCommand("hostname ERRO DE MYSQL");
- }
- else
- {
- printf("Conectado ao banco de dados: %s",MYSQL_DATABASE);
- }
- mysql_tquery(mysql, "SELECT * FROM `config` LIMIT 1", "CarregarConfig", ""); //Carrega as configurações do minijogo.
- return 1;
- }
- public OnFilterScriptExit()
- {
- mysql_format(mysql, global, sizeof(global), "UPDATE `config` SET `p1` ='%i' , `p2` = '%i', `p3`='%i', `final`='%i'",p1,p2,p3,final); //Query
- mysql_tquery(mysql, global, "", ""); //Salva a informação
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Minigame de Paramédico");
- print("----------------------------------\n");
- }
- #endif
- /*Callbacks*/
- public OnPlayerConnect(playerid)
- {
- /*Nome*/
- GetPlayerName(playerid,nome[playerid],24);
- /*String*/
- new query[128];
- /*Textdraw 1*/
- Info_Draws = CreatePlayerTextDraw(playerid, 429.324768, 119.366416, "TEMPO_RESTANTE___02:37");
- PlayerTextDrawLetterSize(playerid, Info_Draws, 0.400000, 1.600000);
- PlayerTextDrawAlignment(playerid, Info_Draws, 1);
- PlayerTextDrawColor(playerid, Info_Draws, -1);
- PlayerTextDrawSetShadow(playerid, Info_Draws, 0);
- PlayerTextDrawSetOutline(playerid, Info_Draws, 1);
- PlayerTextDrawBackgroundColor(playerid, Info_Draws, 255);
- PlayerTextDrawFont(playerid, Info_Draws, 2);
- PlayerTextDrawSetProportional(playerid, Info_Draws, 1);
- PlayerTextDrawSetShadow(playerid, Info_Draws, 0);
- /*Textdraw 2*/
- Info_Draws2 = CreatePlayerTextDraw(playerid, 429.324768, 119.366416, "~n~_______nivel________12~n~~n~~n~assentos_livres______3");
- PlayerTextDrawLetterSize(playerid, Info_Draws2, 0.400000, 1.600000);
- PlayerTextDrawAlignment(playerid, Info_Draws2, 1);
- PlayerTextDrawColor(playerid, Info_Draws2, -1378294017);
- PlayerTextDrawSetShadow(playerid, Info_Draws2, 0);
- PlayerTextDrawSetOutline(playerid, Info_Draws2, 1);
- PlayerTextDrawBackgroundColor(playerid, Info_Draws2, 255);
- PlayerTextDrawFont(playerid, Info_Draws2, 2);
- PlayerTextDrawSetProportional(playerid, Info_Draws2, 1);
- PlayerTextDrawSetShadow(playerid, Info_Draws2, 0);
- KillTimer(Timer[playerid]); //Mata o timer, para impedir conflitos
- Assentos[playerid] = 3; //Muda a quantia de assentos para 3 novamente.
- Minigame[playerid] = 0; //Minigame array mudada novamente para 0.
- Nivel[playerid] = 0; //Nível mudado para 0.
- Salvos[playerid] = 0; //Array salvos para 0, o que significa nenhum paciente
- if(IsValidObject(Equipamento[playerid])) //Ve se o Equipamento (Maca hospitalar) é valido
- {
- DestroyObject(Equipamento[playerid]); //Se for valido, será destruido.
- }
- mysql_format(mysql, query, sizeof(query),"SELECT * FROM `paramedicos` WHERE `nome` = '%e' LIMIT 1", nome[playerid]); //Query
- mysql_tquery(mysql, query, "LoadStuff", "i", playerid); //Carrega a informação relacionada com o minigame.
- return 1;
- }
- forward LoadStuff(playerid);
- public LoadStuff(playerid)
- {
- new rows,fields,query[128];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- Ganhos[playerid] = cache_get_field_content_int(0, "Ganhos");
- PessoasSalvas[playerid] = cache_get_field_content_int(0, "PessoasSalvas");
- NivelMax[playerid] = cache_get_field_content_int(0, "NivelMax");
- }
- else
- {
- mysql_format(mysql, query, sizeof(query), "INSERT INTO `paramedicos` (`nome`, `Ganhos`, `PessoasSalvas`, `NivelMax`) VALUES ('%e', 0, 0, 0)", nome[playerid]);
- mysql_tquery(mysql, query, "", "");
- }
- }
- forward CarregarConfig();
- public CarregarConfig()
- {
- new rows,fields;
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- p1 = cache_get_field_content_int(0,"p1");
- p2 = cache_get_field_content_int(0,"p2");
- p3 = cache_get_field_content_int(0,"p3");
- final = cache_get_field_content_int(0,"final");
- }
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- new query[128];
- 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
- mysql_tquery(mysql, query, "", "");
- SetVehicleVirtualWorld(AmbID[playerid], 0);
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(Salvos[playerid] == 1)
- {
- ClearAnimations(playerid);
- SendClientMessage(playerid,-1,"Não pode entrar na ambulancia sem colocar o paciente e equipamento dentro primeiro.");
- }
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(Assentos[playerid] == 3) return 0;
- switch(Assentos[playerid])
- {
- case 2:
- {
- PessoasSalvas[playerid] += 1;
- Assentos[playerid] = 3;
- GiveMoney(playerid,p1);
- Time[playerid] += 20;
- format(global,sizeof(global),"Pacientes Salvos~n~~n~~n~~n~~w~+20 Segundos~n~~g~+$%i",p1);
- GameTextForPlayer(playerid, global, 5000, 3);
- }
- case 1:
- {
- PessoasSalvas[playerid] += 2;
- Assentos[playerid] = 3;
- GiveMoney(playerid,p2);
- Time[playerid] += 35;
- format(global,sizeof(global),"Pacientes Salvos~n~~n~~n~~n~~w~+35 Segundos~n~~g~+$%i",p2);
- GameTextForPlayer(playerid, global, 5000, 3);
- }
- case 0:
- {
- PessoasSalvas[playerid] += 3;
- Assentos[playerid] = 3;
- GiveMoney(playerid,p3);
- Time[playerid] += 45;
- format(global,sizeof(global),"Pacientes Salvos~n~~n~~n~~n~~w~+45 Segundos~n~~g~+$%i",p3);
- GameTextForPlayer(playerid, global, 5000, 3);
- }
- }
- new count;
- for(new i = 0; i < Nivel[playerid]; i++)
- {
- if(IsValidActor(Atores[playerid][i]))
- {
- count ++;
- }
- }
- if(count > 0) return 1;
- if(Nivel[playerid] < 12)
- {
- Nivel[playerid] ++;
- CriarVitima(playerid);
- if(NivelMax[playerid] < Nivel[playerid])
- {
- NivelMax[playerid] = Nivel[playerid];
- }
- }
- else
- {
- KillTimer(Timer[playerid]);
- GiveMoney(playerid,final);
- format(global,sizeof(global),"MISSAO DE PARAMEDICO ACABOU~n~~n~~n~~n~~g~+$%i",final);
- GameTextForPlayer(playerid, global, 5000, 3);
- Minigame[playerid] = 0;
- Nivel[playerid] = 0;
- PlayerTextDrawHide(playerid,Info_Draws);
- PlayerTextDrawHide(playerid,Info_Draws2);
- DisablePlayerCheckpoint(playerid);
- SetVehicleVirtualWorld(AmbID[playerid], 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- return 1;
- }
- public OnPlayerDeath(playerid,killerid,reason)
- {
- if(Minigame[playerid] == 1)
- {
- KillTimer(Timer[playerid]);
- for(new i = 0; i < Nivel[playerid]; i++)
- {
- DestroyActor(Atores[playerid][i]);
- RemovePlayerMapIcon(playerid, i);
- }
- if(IsValidObject(Equipamento[playerid]))
- {
- DestroyObject(Equipamento[playerid]);
- }
- Minigame[playerid] = 0;
- Nivel[playerid] = 0;
- GameTextForPlayer(playerid, "MISSAO DE PARAMEDICO~n~ACABOU", 5000, 3);
- PlayerTextDrawHide(playerid,Info_Draws);
- PlayerTextDrawHide(playerid,Info_Draws2);
- DisablePlayerCheckpoint(playerid);
- SetVehicleVirtualWorld(AmbID[playerid], 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if ((newkeys & KEY_SUBMISSION))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
- {
- if(minigamestatus == 1)
- {
- if(Minigame[playerid] == 0)
- {
- GameTextForPlayer(playerid, "PARAMEDICO", 5000, 3);
- Minigame[playerid] = 1;
- Time[playerid] = 210;
- Assentos[playerid] = 3;
- Nivel[playerid] = 1;
- Salvos[playerid] = 0;
- Timer[playerid] = SetTimerEx("MiniGame", 1000, true, "i", playerid);
- CriarVitima(playerid);
- AmbID[playerid] = GetPlayerVehicleID(playerid);
- SetPlayerCheckpoint(playerid, 2003.0234,-1444.5896,13.5619, 7.0);
- SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), playerid+1);
- SetPlayerVirtualWorld(playerid, playerid+1);
- }
- else
- {
- KillTimer(Timer[playerid]);
- for(new i = 0; i < Nivel[playerid]; i++)
- {
- DestroyActor(Atores[playerid][i]);
- RemovePlayerMapIcon(playerid, i);
- }
- GameTextForPlayer(playerid, "MISSAO DE PARAMEDICO~n~ACABOU", 5000, 3);
- Minigame[playerid] = 0;
- Nivel[playerid] = 0;
- PlayerTextDrawHide(playerid,Info_Draws);
- PlayerTextDrawHide(playerid,Info_Draws2);
- DisablePlayerCheckpoint(playerid);
- SetVehicleVirtualWorld(AmbID[playerid], 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- }
- else
- {
- SendClientMessage(playerid,-1,"Minigame desativado.");
- }
- }
- }
- }
- return 1;
- }
- public OnActorStreamIn(actorid, forplayerid)
- {
- ApplyActorAnimation(actorid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 0, 0);
- }
- forward MiniGame(playerid);
- public MiniGame(playerid)
- {
- new str[128];
- if(Time[playerid] <= 0)
- {
- KillTimer(Timer[playerid]);
- for(new i = 0; i < Nivel[playerid]; i++)
- {
- DestroyActor(Atores[playerid][i]);
- RemovePlayerMapIcon(playerid, i);
- }
- if(IsValidObject(Equipamento[playerid]))
- {
- DestroyObject(Equipamento[playerid]);
- }
- Minigame[playerid] = 0;
- Nivel[playerid] = 0;
- GameTextForPlayer(playerid, "MISSAO DE PARAMEDICO~n~ACABOU", 5000, 3);
- PlayerTextDrawHide(playerid,Info_Draws);
- PlayerTextDrawHide(playerid,Info_Draws2);
- DisablePlayerCheckpoint(playerid);
- SetVehicleVirtualWorld(AmbID[playerid], 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- else
- {
- Time[playerid] --;
- format(str,sizeof(str),"TEMPO_RESTANTE___%s",TimeConvert(Time[playerid]));
- PlayerTextDrawSetString(playerid,Info_Draws,str);
- PlayerTextDrawShow(playerid,Info_Draws);
- format(str,sizeof(str),"~n~_______nivel________%i~n~~n~~n~Assentos_livres______%i",Nivel[playerid],Assentos[playerid]);
- PlayerTextDrawSetString(playerid,Info_Draws2,str);
- PlayerTextDrawShow(playerid,Info_Draws2);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_INFO)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- new paramedics[500];
- format(paramedics,sizeof(paramedics),"Nome\tNível\tAssentos Livres\tGanhos Totais\n");
- foreach(new i: Player)
- {
- if(Minigame[i] == 1)
- {
- format(paramedics,sizeof(paramedics),"{FFFFFF}%s%s\t%i\t%i\t{00FF00}$%i\n",paramedics,nome[i],Nivel[i],Assentos[i],Ganhos[i]);
- }
- }
- ShowPlayerDialog(playerid, DIALOG_PARA, DIALOG_STYLE_TABLIST_HEADERS,"Informação de Paramédico » {FFFFFF}Lista de Paramédicos",paramedics,"Voltar","Fechar");
- }
- case 1:
- {
- ShowPlayerDialog(playerid,DIALOG_PAID, DIALOG_STYLE_INPUT, "Informação de Paramédico » {FFFFFF}Estatísticas", "Entre o ID de um jogador abaixo:", "Confirmar", "Cancelar");
- }
- case 2:
- {
- new name[100],string[500];
- format(name,sizeof(name),"Informação de Paramédico » {FFFFFF}Estatísticas » %s",nome[playerid]);
- 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]);
- ShowPlayerDialog(playerid, DIALOG_OTHER, DIALOG_STYLE_TABLIST, name, string, "Fechar", "");
- }
- }
- }
- }
- if(dialogid == DIALOG_PARA)
- {
- if(response)
- {
- new string[700];
- format(string,sizeof(string),"{FFFFFF}» Paramédicos {FF0000}(%i)\n{FFFFFF}» Estatísticas\n» Minhas Estatísticas",QuantidadeDeParamedicos());
- ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_LIST, "Informação de Paramédico",string, "Selecionar","Cancelar");
- }
- }
- if(dialogid == DIALOG_PAID)
- {
- if(response)
- {
- new name[100],string[500];
- format(name,sizeof(name),"Informação de Paramédico » {FFFFFF}Estatísticas » %s",nome[strval(inputtext)]);
- 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)]);
- ShowPlayerDialog(playerid, DIALOG_OTHER, DIALOG_STYLE_TABLIST, name, string, "Fechar", "");
- }
- }
- if(dialogid == DIALOG_RCON)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- 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");
- }
- case 1:
- {
- new Float:X,Float:Y,Float:Z,Float:R,x[30],y[30],z[30],r[30];
- GetPlayerPos(playerid,X,Y,Z),GetPlayerFacingAngle(playerid,R);
- format(x,sizeof(x),"%f",X),format(y,sizeof(y),"%f",Y);
- format(z,sizeof(z),"%f",Z),format(r,sizeof(r),"%f",R);
- mysql_format(mysql, global, sizeof(global), "INSERT INTO `Atores` (`ActorX`, `ActorY`, `ActorZ`, `ActorR`) VALUES ('%e', '%e', '%e', '%e')", x,y,z,r);
- mysql_tquery(mysql, global, "", "");
- SendClientMessage(playerid,-1,"Spawn de Ator criado na sua posição");
- }
- case 2:
- {
- ShowPlayerDialog(playerid,DIALOG_RCON7, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Ir para spawn de ator", "Entre o id do spawn de ator:", "Confirmar", "Cancelar");
- }
- case 3:
- {
- ShowPlayerDialog(playerid,DIALOG_RCON8, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Remover spawn de ator", "Entre o id do spawn de ator:", "Confirmar", "Cancelar");
- }
- case 4:
- {
- if(minigamestatus == 1)
- {
- minigamestatus = 0;
- SendClientMessage(playerid,-1,"Minigame desativado.");
- }
- else
- {
- minigamestatus = 1;
- SendClientMessage(playerid,-1,"Minigame ativado.");
- }
- }
- }
- }
- }
- if(dialogid == DIALOG_RCON2)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: ShowPlayerDialog(playerid,DIALOG_RCON3, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » 1 Pacientes", "Entre o valor abaixo:", "Confirmar", "Cancelar");
- case 1: ShowPlayerDialog(playerid,DIALOG_RCON4, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » 2 Pacientes", "Entre o valor abaixo:", "Confirmar", "Cancelar");
- case 2: ShowPlayerDialog(playerid,DIALOG_RCON5, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » 3 Pacientes", "Entre o valor abaixo:", "Confirmar", "Cancelar");
- case 3: ShowPlayerDialog(playerid,DIALOG_RCON6, DIALOG_STYLE_INPUT, "Minigame » {FFFFFF}Mudar Ganhos » Fim do Game", "Entre o valor abaixo:", "Confirmar", "Cancelar");
- }
- }
- }
- if(dialogid == DIALOG_RCON3)
- {
- if(response)
- {
- p1 = strval(inputtext);
- format(global,sizeof(global),"Ganhos por entregar 1 paciente mudados a '$%i'",p1);
- SendClientMessage(playerid,-1,global);
- }
- }
- if(dialogid == DIALOG_RCON4)
- {
- if(response)
- {
- p2 = strval(inputtext);
- format(global,sizeof(global),"Ganhos por entregar 2 pacientes mudados a '$%i'",p2);
- SendClientMessage(playerid,-1,global);
- }
- }
- if(dialogid == DIALOG_RCON5)
- {
- if(response)
- {
- p3 = strval(inputtext);
- format(global,sizeof(global),"Ganhos por entregar 3 pacientes mudados a '$%i'",p3);
- SendClientMessage(playerid,-1,global);
- }
- }
- if(dialogid == DIALOG_RCON6)
- {
- if(response)
- {
- final = strval(inputtext);
- format(global,sizeof(global),"Ganhos por terminar o minigame mudados a '$%i'",final);
- SendClientMessage(playerid,-1,global);
- }
- }
- if(dialogid == DIALOG_RCON7)
- {
- if(response)
- {
- mysql_format(mysql, global, sizeof(global),"SELECT * FROM `Atores` WHERE `aid` = '%i' LIMIT 1", strval(inputtext));
- mysql_tquery(mysql, global, "GotoActor", "i", playerid);
- }
- }
- if(dialogid == DIALOG_RCON8)
- {
- if(response)
- {
- mysql_format(mysql, global, sizeof(global),"DELETE FROM `Atores` WHERE `aid` = '%i' LIMIT 1",strval(inputtext));
- mysql_tquery(mysql, global,"","");
- format(global,sizeof(global),"Você removeu o spawn de ator id '%i'",strval(inputtext));
- SendClientMessage(playerid,-1,global);
- }
- }
- return 1;
- }
- forward GotoActor(playerid);
- public GotoActor(playerid)
- {
- new rows,fields,x[30],y[30],z[30],r[30];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- cache_get_field_content(0, "ActorX", x, mysql, 30);
- cache_get_field_content(0, "ActorY", y, mysql, 30);
- cache_get_field_content(0, "ActorZ", z, mysql, 30);
- cache_get_field_content(0, "ActorR", r, mysql, 30);
- SetPlayerPos(playerid,floatstr(x),floatstr(y),floatstr(z));
- SetPlayerFacingAngle(playerid,floatstr(r));
- }
- else
- {
- SendClientMessage(playerid,-1,"Spawn ID Invalido.");
- }
- }
- /*Funções*/
- SkinsAleatorios()
- {
- new skinid;
- switch(random(7))
- {
- case 0: skinid = 280;
- case 1: skinid = 165;
- case 2: skinid = 76;
- case 3: skinid = 166;
- case 4: skinid = 168;
- case 5: skinid = 185;
- case 6: skinid = 188;
- }
- return skinid;
- }
- CriarVitima(playerid)
- {
- mysql_format(mysql, global, sizeof(global), "SELECT * FROM `Atores` ORDER BY RAND() LIMIT %i",Nivel[playerid]);
- mysql_tquery(mysql, global, "CriarAtores", "i",playerid);
- }
- forward CriarAtores(playerid);
- public CriarAtores(playerid)
- {
- new Aztores = cache_get_row_count(),x[30],y[30],z[30],r[30];
- for(new i = 0; i < Aztores; i++)
- {
- cache_get_field_content(i, "ActorX", x, mysql, 30);
- cache_get_field_content(i, "ActorY", y, mysql, 30);
- cache_get_field_content(i, "ActorZ", z, mysql, 30);
- cache_get_field_content(i, "ActorR", r, mysql, 30);
- Atores[playerid][i] = CreateActor(SkinsAleatorios(), floatstr(x), floatstr(y), floatstr(z), floatstr(r));
- SetPlayerMapIcon(playerid, i, floatstr(x), floatstr(y), floatstr(z), 0, 0x0000BBAA, MAPICON_GLOBAL);
- ApplyActorAnimation(Atores[playerid][i], "CRACK", "crckdeth2", 4.1, 0, 0, 0, 0, 0);
- SetActorVirtualWorld(Atores[playerid][i], playerid+1);
- }
- }
- TimeConvert(time)
- {
- new minutes;
- new seconds;
- new string[10];
- if(time > 59)
- {
- minutes = floatround(time / 60);
- seconds = floatround(time - minutes*60);
- if(seconds > 9)format(string,sizeof(string),"%d:%d",minutes,seconds);
- else format(string,sizeof(string),"%d:0%d",minutes,seconds);
- }
- else
- {
- seconds = floatround(time);
- if(seconds > 9)format(string,sizeof(string),"0:%d",seconds);
- else format(string,sizeof(string),"0:0%d",seconds);
- }
- return string;
- }
- GiveMoney(playerid,money)
- {
- Ganhos[playerid] += money;
- GivePlayerMoney(playerid,money);
- }
- QuantidadeDeParamedicos()
- {
- new count=0;
- foreach(new p: Player)
- {
- if(Minigame[p] == 1) count++;
- }
- return count;
- }
- /*Commands*/
- CMD:salvar(playerid)
- {
- if(!IsValidObject(Equipamento[playerid])) return SendClientMessage(playerid,-1,"Va proximo da ambulancia e pegue seu equipamento primeiro (/maca)");
- if(Salvos[playerid] == 1) return SendClientMessage(playerid,-1,"Tem um paciente com você, coloque o primeiramente na ambulancia (/maca)");
- new Float:x,Float:y,Float:z;
- for(new i = 0; i < Nivel[playerid]; i++)
- {
- GetActorPos(Atores[playerid][i], x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
- {
- RemovePlayerMapIcon(playerid, i);
- DestroyActor(Atores[playerid][i]);
- Salvos[playerid] = 1;
- SendClientMessage(playerid,-1,"Va proximo da ambulancia e use /maca para colocar o paciente e equipamento dentro.");
- }
- }
- return 1;
- }
- CMD:maca(playerid)
- {
- if(Minigame[playerid] == 0) return SendClientMessage(playerid,-1,"Nao esta no minigame de Paramédico");
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Deve sair de seu veiculo primeiro...");
- if(Assentos[playerid] == 0) return SendClientMessage(playerid,-1,"Nenhum assento livre, deixe os pacientes no hospital primeiro.");
- new Float:x,Float:y,Float:z;
- GetVehiclePos(AmbID[playerid],x,y,z);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
- {
- if(!IsValidObject(Equipamento[playerid]))
- {
- Equipamento[playerid] = CreateObject(2146, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- AttachObjectToPlayer(Equipamento[playerid], playerid, -0.050000, 1.518999, -0.500000, 2.200002, -0.500136, 0.000000);
- }
- else
- {
- DestroyObject(Equipamento[playerid]);
- if(Salvos[playerid] == 1)
- {
- Assentos[playerid] --;
- Salvos[playerid] = 0;
- Time[playerid] += 25;
- GameTextForPlayer(playerid, "Salvos!~n~~n~~n~~n~~w~+25 Segundos", 5000, 3);
- }
- }
- }
- else
- {
- SendClientMessage(playerid,-1,"Deve estar proximo da ambulancia para pegar/guardar seu equipamento.");
- }
- return 1;
- }
- CMD:pinfo(playerid)
- {
- new string[700];
- format(string,sizeof(string),"{FFFFFF}» Paramédicos {FF0000}(%i)\n{FFFFFF}» Estatisticas\n{FFFFFF}» Minhas Estatisticas",QuantidadeDeParamedicos());
- ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_LIST, "Informação de Paramédico",string, "Selecionar","Cancelar");
- return 1;
- }
- CMD:minigame(playerid)
- {
- if(IsPlayerAdmin(playerid))
- {
- if(minigamestatus == 1)
- {
- 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");
- }
- else
- {
- 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");
- }
- }
- return 1;
- }
- CMD:test(playerid)
- {
- if(IsPlayerAdmin(playerid))
- {
- SetPlayerPos(playerid,2019.1501,-1420.2346,16.9922);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement