stock GetVehicleVelocityEx(playerid) { new Float:Velocity[3], Float:fl; GetVehicleVelocity(GetPlayerVehicleID(playerid),Velocity[0],Velocity[1],Velocity[2]); fl = floatsqroot(floatpower(Velocity[0], 2) + floatpower(Velocity[1], 2) + floatpower(Velocity[2], 2)) * 160; return floatround(fl); } public OnPlayerUpdate(playerid) { if(InAutoEscola[playerid] == 1 && GetVehicleVelocityEx(playerid) > 50) { SetPVarInt(playerid, "Reprovado", 1); } return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { 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."); DeletePVar(playerid, "Reprovado"); return 1; } if ( GetPVarInt(playerid, "Reprovado") == 1 ) { DisablePlayerRaceCheckpoint(playerid); new currentveh; currentveh = GetPlayerVehicleID(playerid); DestroyVehicle(currentveh); SendClientMessage(playerid,-1,"(AUTO ESCOLA) Reprovado!! Exedeu o limite de velocidade! (50 KM/h)."); DeletePVar(playerid, "Reprovado"); 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."); DeletePVar(playerid, "Reprovado"); return 1; } } } return 1; }
Se nгo quiseram fazer min falem qual variavel, funзгo devo fazer '-'
|
new ContarHAB[MAX_PLAYERS];
forward playerHab(playerid);
public playerHab(playerid) {
new String[128];
if(GetVehicleVelocityEx(playerid) > 100) {
ContarHAB[playerid] ++;
format(String, 128, "[ AVISO ]: Vocк estб ultrapassando o limite de velocidade - %i", GetVehicleVelocityEx(playerid));
SendClientMessage(playerid, -1, String);
}
if(ContarHAB[playerid] >= 3) {
SendClientMessage(playerid, -1, "Vocк nгo conseguiu terminar o teste! Abraзos");
ContarHAB[playerid] = 0;
}
return true;
}
SetTimerEx("playerHab", 1000, false, "i", playerid); // Coloca quando ele iniciar o teste