Novidades

9/13/2020

CharaDa_Fox

[FilterScript] Sistema de auto escola para samp mobile

 No topo do Game Mode


pawn Код:
#include <a_samp>
#include <cpstream>

#define DIALOG_AUTOESCOLA       0

new InAutoEscola[MAX_PLAYERS];
new carroauto[MAX_PLAYERS];
new CPAutoEscola;

new point[MAX_PLAYERS];
new Float:AutoPoints[8][3] = //Cordenadas dos Race Checkpoints
{
     {566.0122,-1240.4834,16.9812},
     {647.4115,-1202.2354,17.8508},
     {794.5209,-1061.8385,24.4309},
     {797.8555,-1255.2906,13.2295},
     {782.1776,-1318.7532,13.1247},
     {632.7460,-1290.5117,15.1381},
     {595.6362,-1228.1689,17.5915},
     {561.3011,-1279.6729,16.9883}
};

public OnGameModeInit()

pawn Код:
CPAutoEscola = CPS_AddCheckpoint(545.2621,-1284.9412,17.2482,2.0,80);

public OnPlayerDeath(playerid, killerid, reason)

pawn Код:
if(InAutoEscola[playerid] == 1)
    {
        new currentveh;
        currentveh = GetPlayerVehicleID(playerid);
        DestroyVehicle(currentveh);
        InAutoEscola[playerid] = 0;
        DisablePlayerRaceCheckpoint(playerid);
    }

public OnPlayerEnterCheckpoint(playerid)

pawn Код:
if(CPS_IsPlayerInCheckpoint(playerid,CPAutoEscola))
    {
        if(pDados[playerid][Carteira] == 0)
        {
            ShowPlayerDialog(playerid,DIALOG_AUTOESCOLA,DIALOG_STYLE_MSGBOX,"AUTO ESCOLA","Voce gostaria de comeзar os teste da Auto Escola?","Sim","Nao");
            return 1;
        }else return SendClientMessage(playerid,-1,"(AUTO ESCOLA) Voce ja possui Carteira.");
    }

public OnPlayerEnterRaceCheckpoint(playerid)

pawn Код:
switch(point[playerid])
     {
         case 1:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[1][0], AutoPoints[1][1], AutoPoints[1][2],AutoPoints[2][0], AutoPoints[2][1], AutoPoints[2][2], 10);
              point[playerid] = 2;
              return 1;
         }
         case 2:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[2][0], AutoPoints[2][1], AutoPoints[2][2],AutoPoints[3][0], AutoPoints[3][1], AutoPoints[3][2], 10);
              point[playerid] = 3;
              return 1;
         }
         case 3:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[3][0], AutoPoints[3][1], AutoPoints[3][2],AutoPoints[4][0], AutoPoints[4][1], AutoPoints[4][2], 10);
              point[playerid] = 4;
              return 1;
         }
         case 4:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[4][0], AutoPoints[4][1], AutoPoints[4][2],AutoPoints[5][0], AutoPoints[5][1], AutoPoints[5][2], 10);
              point[playerid] = 5;
              return 1;
         }
         case 5:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[5][0], AutoPoints[5][1], AutoPoints[5][2],AutoPoints[6][0], AutoPoints[6][1], AutoPoints[6][2], 10);
              point[playerid] = 6;
              return 1;
         }
         case 6:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[6][0], AutoPoints[6][1], AutoPoints[6][2],AutoPoints[7][0], AutoPoints[7][1], AutoPoints[7][2], 10);
              point[playerid] = 7;
              return 1;
         }
         case 7:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[7][0], AutoPoints[7][1], AutoPoints[7][2],AutoPoints[7][0], AutoPoints[7][1], AutoPoints[7][2], 10);
              point[playerid] = 8;
              return 1;
         }
         case 8:
         {
            if(IsPlayerInVehicle(playerid, carroauto[playerid]))
            {
              new Float:lataria;
              GetVehicleHealth(carroauto[playerid], lataria);
              if(lataria < 87)
              {
                DisablePlayerRaceCheckpoint(playerid);
                new currentveh;
                currentveh = GetPlayerVehicleID(playerid);
                DestroyVehicle(currentveh);
                SendClientMessage(playerid,-1,"(AUTO ESCOLA) Reprovado!! Voce danificou muito a lataria do veiculo.");
                return 1;
              }
              DisablePlayerRaceCheckpoint(playerid);
              GameTextForPlayer(playerid, "AUTO ESCOLA COMPLETA", 3000, 1);
              pDados[playerid][Carteira] = 1;
              InAutoEscola[playerid] = 0;
              new currentveh;
              currentveh = GetPlayerVehicleID(playerid);
              DestroyVehicle(currentveh);
              return 1;
            }
            else
            {
                DisablePlayerRaceCheckpoint(playerid);
                new currentveh;
                currentveh = GetPlayerVehicleID(playerid);
                DestroyVehicle(currentveh);
                SendClientMessage(playerid,-1,"(AUTO ESCOLA) Reprovado!! Voce nao estao em um veiculo da Auto Escola.");
                return 1;
            }
         }
     }

public OnPlayerDialogResponse

pawn Код:
if(dialogid == DIALOG_AUTOESCOLA)
    {
        if(response == 1)
        {
            InAutoEscola[playerid] = 1;
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            carroauto[playerid] = CreateVehicle(466, X,Y,Z,297.6633, 0, 0, -1);
            PutPlayerInVehicle(playerid, carroauto[playerid], 0);
            SendClientMessage(playerid,-1,"(AUTO ESCOLA) Voce iniciou a auto escola,siga as setas.");
            SetPlayerRaceCheckpoint(playerid, 0, AutoPoints[0][0], AutoPoints[0][1], AutoPoints[0][2],AutoPoints[1][0], AutoPoints[1][1], AutoPoints[1][2], 10);
            point[playerid] = 1;
            GivePlayerMoney(playerid, -200);
            return 1;
        }
        if(response == 0)
        {
            SendClientMessage(playerid,-1,"(AUTO ESCOLA) Voce desistiu da auto escola.");
            GivePlayerMoney(playerid, -200);
            return 1;
        }

    }

Subscribe to this Blog via Email :
Previous
Next Post »