Darth_Vader

Profissão de paramédico

Jun 19th, 2020
2,670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.40 KB | None | 0 0
  1. // Sistema de carteira de motorista e radar feito por Darth_Vader, mantenha os créditos porfavor //
  2. #include <a_samp>
  3. // Modelo do veículo
  4. #define VMedic 416
  5. // Variaveis
  6. new PacientePoint[MAX_PLAYERS], TerminarMissao[MAX_PLAYERS], PacientesCurados[MAX_PLAYERS], TempoSaiudoCarro[MAX_PLAYERS], Contar[MAX_PLAYERS],
  7.     Paciente[MAX_PLAYERS], ContarBatidas[MAX_PLAYERS], bool:IsAMed[MAX_PLAYERS], bool:Trabalhando[MAX_PLAYERS], bool:SaiudoCarro[MAX_PLAYERS],
  8.     ParamedicoPickup, String[128], Float:x, Float:y, Float:z;
  9. // Localização e skin dos pacientes
  10. enum TPacientes
  11. {
  12.     LocalPaciente[50],
  13.     Float:PaciX,
  14.     Float:PaciY,
  15.     Float:PaciZ
  16. }
  17. new APacientes[][TPacientes] =
  18. {
  19.     {"Old Venturas Strip", 2250.7146,2158.7766,10.8203},
  20.     {"The Visage", 2024.2467,1920.5061,12.3389},
  21.     {"Las Venturas Airport - A", 1725.4508,1528.3914,10.8203},
  22.     {"Las Venturas Airport - B", 1712.5109,1266.7162,10.7140},
  23.     {"Caligula's Palace", 2081.6206,1703.4639,10.8203},
  24.     {"The Strip", 2160.4744,2068.6152,10.8203},
  25.     {"Redsands East", 2048.5957,2121.2590,10.8203},
  26.     {"The Emerald Isle", 2128.7043,2354.6108,10.6719},
  27.     {"The Camel's Toe", 2150.8528,1365.1405,10.8203},
  28.     {"The Pink Swan", 2035.8386,1174.2395,10.8203}
  29. };
  30. new SkinPaciente[] =
  31. {
  32.     1,
  33.     4,
  34.     6,
  35.     15,
  36.     20,
  37.     21,
  38.     78,
  39.     101
  40. };
  41. public OnGameModeInit()
  42. {
  43.     // Mantenha os créditos porfavor //
  44.     print("\n\n   Sistema de carteira de motorista e radar feito por Darth_Vader\n\n");
  45.     // Pickup do emprego
  46.     ParamedicoPickup = CreatePickup(1581, 2, 1607.2861, 1817.0649, 10.8203), Create3DTextLabel("{00FF7F}Aproxime-se para torna-se um\n{FFFFFF}paramedico", -1, 1607.2861, 1817.0649, 10.8203, 15, 0, 0);
  47.     // Veiculos
  48.     AddStaticVehicle(VMedic, 1617.0050, 1830.9409, 10.9694, 179, 1, 3);
  49.     AddStaticVehicle(VMedic, 1612.6760, 1830.9409, 10.4505, 179, 1, 3);
  50.     AddStaticVehicle(VMedic, 1608.5352, 1830.9409, 10.4505, 179, 1, 3);
  51.     AddStaticVehicle(VMedic, 1604.2271, 1830.9409, 10.4505, 179, 1, 3);
  52.     AddStaticVehicle(VMedic, 1600.1797, 1830.9409, 10.4505, 179, 1, 3);
  53.     AddStaticVehicle(VMedic, 1596.1735, 1830.9409, 10.4505, 179, 1, 3);
  54.     return 1;
  55. }
  56. // Mantenha os créditos porfavor //
  57. public OnPlayerConnect(playerid) return SendClientMessage(playerid, -1, "Esse servidor possui um sistema de carteira de motorista feito por Darth_Vader");
  58. public OnPlayerStateChange(playerid, newstate, oldstate)
  59. {
  60.     new vehicleid = GetPlayerVehicleID(playerid);
  61.     if(newstate == PLAYER_STATE_DRIVER)
  62.     {
  63.         if(GetVehicleModel(vehicleid) == VMedic && IsAMed[playerid] == false) return SendClientMessage(playerid, -1, "{FF0000}Voce nao pode usar um veiculo de Paramedico."), RemovePlayerFromVehicle(playerid);
  64.         if(GetVehicleModel(vehicleid) == VMedic && IsAMed[playerid] == true && Trabalhando[playerid] == false && PacientesCurados[playerid] < 5) return SetTimerEx("ComecarTrabalho", 5000, false, "i", playerid);
  65.         if(Trabalhando[playerid] == true && SaiudoCarro[playerid] == true) return KillTimer(TempoSaiudoCarro[playerid]);
  66.     }
  67.     if(Trabalhando[playerid] == true && newstate != PLAYER_STATE_DRIVER) return SaiudoCarro[playerid] = true, Contar[playerid] = 60, TempoSaiudoCarro[playerid] = SetTimerEx("ForadoCarro", 1000, true, "i", playerid);
  68.     return 1;
  69. }
  70. public OnPlayerEnterCheckpoint(playerid)
  71. {
  72.     if(PacientePoint[playerid])
  73.     {
  74.         if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{FF0000}({FFFFFF}ERRO{FF0000})Você tem que estar de pé para cuidar do {FFFFFF}paciente{FF0000}.");
  75.         ApplyAnimation(playerid,"MEDIC","CPR",4.1,0,1,1,1,1);
  76.         SetTimerEx("SonsdoTrabalho", 3176, false, "i", playerid), ContarBatidas[playerid] = 1;
  77.         TerminarMissao[playerid] = SetTimerEx("FimdoTrabalho", 6000, false, "i", playerid);
  78.         GameTextForPlayer(playerid,"Fazendo massagem cardiaca..", 6000, 5);
  79.         DisablePlayerCheckpoint(playerid), KillTimer(TempoSaiudoCarro[playerid]);
  80.     }
  81.     return 1;
  82. }
  83. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  84. {
  85.     if(newkeys==KEY_CTRL_BACK) return AcabarTrabalho(playerid);
  86.     return 1;
  87. }
  88. public OnPlayerPickUpPickup(playerid, pickupid)
  89. {
  90.     if(pickupid == ParamedicoPickup)
  91.     {
  92.         if(IsAMed[playerid] == false) return IsAMed[playerid] = true, SetPlayerSkin(playerid, 276);
  93.     }
  94.     return 1;
  95. }
  96. forward ComecarTrabalho(playerid);
  97. public ComecarTrabalho(playerid)
  98. {
  99.     new Rand;
  100.     Trabalhando[playerid] = true, Rand = random(sizeof(APacientes));
  101.     format(String, sizeof(String), "{00FF7F}Paciente desmaiado na redondezas de {FFFFFF}%s{00FF7F}.", APacientes[Rand][LocalPaciente]);
  102.     SendClientMessage(playerid, -1, String);
  103.     x = APacientes[Rand][PaciX], y = APacientes[Rand][PaciY], z = APacientes[Rand][PaciZ];
  104.     Paciente[playerid] = CreateActor(SkinPaciente[random(sizeof(SkinPaciente))], x, y, z, 0.60);
  105.     ApplyActorAnimation(Paciente[playerid],"PED","EV_dive",4.0,0,1,1, 1,0);
  106.     PacientePoint[playerid] = SetPlayerCheckpoint(playerid, x, y, z, 1.0);
  107.     return 1;
  108. }
  109. forward SonsdoTrabalho(playerid);
  110. public SonsdoTrabalho(playerid)
  111. {
  112.     if(ContarBatidas[playerid] == 1) return ContarBatidas[playerid]++, PlayerPlaySound(playerid, 1163, 0, 0 , 0), SetTimerEx("SonsdoTrabalho", 1176, false, "i", playerid);
  113.     if(ContarBatidas[playerid] == 2) return ContarBatidas[playerid]++, PlayerPlaySound(playerid, 1163, 0, 0 , 0), SetTimerEx("SonsdoTrabalho", 1176, false, "i", playerid);
  114.     if(ContarBatidas[playerid] == 3) return ContarBatidas[playerid] = 0, PlayerPlaySound(playerid, 1163, 0, 0 , 0);
  115.     return 0;
  116. }
  117. forward FimdoTrabalho(playerid);
  118. public FimdoTrabalho(playerid)
  119. {
  120.     GivePlayerMoney(playerid, 4500), SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
  121.     ClearActorAnimations(Paciente[playerid]), PacientesCurados[playerid]++;
  122.     ApplyActorAnimation(Paciente[playerid], "PED", "IDLE_tired", 3.0, 1, 0, 0, 0, 10000);
  123.     GetPlayerPos(playerid, x, y, z), SetPlayerPos(playerid, x, y, z+1),
  124.     SendClientMessage(playerid, -1, "{A9C4E4}Você ganhou {00FF00}R${FFFFFF}4500 {A9C4E4}+ {FFFFFF}1 {A9C4E4}score por ter curado o paciente.");
  125.     TempoSaiudoCarro[playerid] = SetTimerEx("ForadoCarro", 1000, true, "i", playerid), SaiudoCarro[playerid] = true;
  126.     if(PacientesCurados[playerid] < 5) return SetTimerEx("RemoverPaciente", 8000, false, "i", playerid), SetTimerEx("ComecarTrabalho", 11000, false, "i" , playerid);
  127.     else if(PacientesCurados[playerid] == 5)
  128.     {
  129.         new Nome[24];
  130.         GetPlayerName(playerid, Nome, sizeof(Nome));
  131.         format(String, sizeof(String), "{00FF7F}O Medico {FFFFFF}%s {00FF7F}curou 5 pacientes.", Nome);
  132.         SendClientMessageToAll(-1, String);
  133.         Trabalhando[playerid] = false, PacientesCurados[playerid] = 0, SetTimerEx("RemoverPaciente", 4000, false, "i", playerid), KillTimer(TempoSaiudoCarro[playerid]), KillTimer(TerminarMissao[playerid]);
  134.     }
  135.     return 0;
  136. }
  137. forward ForadoCarro(playerid);
  138. public ForadoCarro(playerid)
  139. {
  140.     new TextoContar[128];
  141.     if(Contar[playerid] == 0) return SetTimerEx("AcabarTrabalho", 1000, false, "i", playerid);
  142.     if(Contar[playerid] > 0)
  143.     {
  144.         Contar[playerid]--;
  145.     }
  146.     format(TextoContar, sizeof(TextoContar), "~g~Voce tem ~w~%i ~g~para voltar para o veiculo!", Contar[playerid]);
  147.     GameTextForPlayer(playerid, TextoContar, 1000, 4);
  148.     return 1;
  149. }
  150. forward AcabarTrabalho(playerid);
  151. public AcabarTrabalho(playerid) return DisablePlayerCheckpoint(playerid), RemoverPaciente(playerid), KillTimer(TempoSaiudoCarro[playerid]), Trabalhando[playerid] = false, PacientesCurados[playerid] = 0, KillTimer(TerminarMissao[playerid]);
  152. forward RemoverPaciente(playerid);
  153. public RemoverPaciente(playerid) return DestroyActor(Paciente[playerid]);
Advertisement
Add Comment
Please, Sign In to add comment