Sistema de Auto Escola
Estou aqui na madrugada de sexta-feira para sabado sem fazer nada entao resolvi gastar um tempo criando um sistema simples de auto escola.
Caracteristicas:
Caso queira mudar o local onde sera a auto escola ou mudar/adicionar mais RaceCheckpoints basta trocar as coordenadas ou adicionar novas coordenadas seguindo a logica,nada complicado.
Basta modificar algumas coisas caso necessite para seu GameMode
http://i.imgur.com/wi76brn.png
http://i.imgur.com/wi76brn.png
http://i.imgur.com/VEVpXUR.png
http://i.imgur.com/EiRKGDZ.png
- RaceCheckPoints
- Verifica se o player esta no veiculo da auto escola
- Lataria abaixo de 87 o player é reprovado
Caso queira mudar o local onde sera a auto escola ou mudar/adicionar mais RaceCheckpoints basta trocar as coordenadas ou adicionar novas coordenadas seguindo a logica,nada complicado.
Basta modificar algumas coisas caso necessite para seu GameMode
Screenshots
http://i.imgur.com/wi76brn.png
http://i.imgur.com/wi76brn.png
http://i.imgur.com/VEVpXUR.png
http://i.imgur.com/EiRKGDZ.png
No topo do Game Mode
pawn Code:
#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 Code:
CPAutoEscola = CPS_AddCheckpoint(545.2621,-1284.9412,17.2482,2.0,80);
public OnPlayerDeath(playerid, killerid, reason)
pawn Code:
if(InAutoEscola[playerid] == 1) { new currentveh; currentveh = GetPlayerVehicleID(playerid); DestroyVehicle(currentveh); InAutoEscola[playerid] = 0; DisablePlayerRaceCheckpoint(playerid); }
public OnPlayerEnterCheckpoint(playerid)
pawn Code:
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 Code:
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 Code:
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; } }
0 comentários:
Postar um comentário