Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new speedo[MAX_PLAYERS];
- new shift[MAX_PLAYERS];
- new Float:VehHealth;
- new perdervida[MAX_PLAYERS];
- new Float:ppos[MAX_PLAYERS][3];
- forward Destravar(playerid);
- forward UpdateSpeed();
- forward MarchaUp();
- forward MatarTempo();
- forward TirarVida(playerid,vehicleid);
- forward PassarMarcha(playerid);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Gears");
- print("--------------------------------------\n");
- SetTimer("UpdateSpeed", 500, 1);
- SetTimer("MarchaUp",500, 1);
- SetTimer("TirarVida",1000,1);
- SetTimer("MatarTempo",1000,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public UpdateSpeed(){
- for(new i=0;i<MAX_PLAYERS;i++){
- if(IsPlayerConnected(i)){
- new string[256];
- new Float:x,Float:y,Float:z;
- GetPlayerPos(i,x,y,z);
- new
- Float:xOff = ppos[i][0] - x,
- Float:yOff = ppos[i][1] - y,
- Float:zOff = ppos[i][2] - z,
- Float:dis = floatsqroot((xOff * xOff) + (yOff * yOff) + (zOff * zOff));
- format(string, sizeof string, "~n~~n~~n~~n~~n~~n~~w~%d ~h~km/h Shift:%d", speedo[i], shift[i]);
- if(IsPlayerInAnyVehicle(i)){
- speedo[i] = floatround(((dis/1000.0)*60.0)*60.0);
- }
- ppos[i][0] = x;
- ppos[i][1] = y;
- ppos[i][2] = z;
- }
- }
- }
- public MarchaUp()
- {
- for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i) && GetPlayerState(i) == 2)
- {
- if(speedo[i] >= 0 && speedo[i] <= 80){
- if(speedo[i] >= 0 && speedo[i] <= 8){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~�~w~��������", 1000, 3); }
- if(speedo[i] >= 8 && speedo[i] <= 17){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~��~w~�������", 1000, 3); }
- if(speedo[i] >= 17 && speedo[i] <= 25){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~w~������", 1000, 3); }
- if(speedo[i] >= 25 && speedo[i] <= 32){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~�~w~�����", 1000, 3); }
- if(speedo[i] >= 32 && speedo[i] <= 40){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~��~w~����", 1000, 3); }
- if(speedo[i] >= 40 && speedo[i] <= 50){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~w~���", 1000, 3); }
- if(speedo[i] >= 50 && speedo[i] <= 60){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~�~w~��", 1000, 3); }
- if(speedo[i] >= 60 && speedo[i] <= 70){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~��~w~�", 1000, 3); }
- if(speedo[i] >= 70 && speedo[i] <= 80){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~���", 1000, 3); }
- return 1;
- }else if(speedo[i] >= 80 && speedo[i] <= 120){
- if(speedo[i] >= 80 && speedo[i] <= 84){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~�~w~��������", 1000, 3); }
- if(speedo[i] >= 84 && speedo[i] <= 89){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~��~w~�������", 1000, 3); }
- if(speedo[i] >= 89 && speedo[i] <= 93){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~w~������", 1000, 3); }
- if(speedo[i] >= 93 && speedo[i] <= 98){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~�~w~�����", 1000, 3); }
- if(speedo[i] >= 98 && speedo[i] <= 102){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~��~w~����", 1000, 3); }
- if(speedo[i] >= 102 && speedo[i] <= 107){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~w~���", 1000, 3); }
- if(speedo[i] >= 107 && speedo[i] <= 111){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~�~w~��", 1000, 3); }
- if(speedo[i] >= 111 && speedo[i] <= 116){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~��~w~�", 1000, 3); }
- if(speedo[i] >= 116 && speedo[i] <= 120){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~���", 1000, 3); }
- return 1;
- }else if(speedo[i] >= 120 && speedo[i] <= 160){
- if(speedo[i] >= 120 && speedo[i] <= 124){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~�~w~��������", 1000, 3); }
- if(speedo[i] >= 124 && speedo[i] <= 129){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~��~w~�������", 1000, 3); }
- if(speedo[i] >= 129 && speedo[i] <= 133){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~w~������", 1000, 3); }
- if(speedo[i] >= 133 && speedo[i] <= 138){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~�~w~�����", 1000, 3); }
- if(speedo[i] >= 138 && speedo[i] <= 142){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~��~w~����", 1000, 3); }
- if(speedo[i] >= 142 && speedo[i] <= 147){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~w~���", 1000, 3); }
- if(speedo[i] >= 147 && speedo[i] <= 151){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~�~w~��", 1000, 3); }
- if(speedo[i] >= 151 && speedo[i] <= 156){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~��~w~�", 1000, 3); }
- if(speedo[i] >= 156 && speedo[i] <= 160){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~���", 1000, 3); }
- return 1;
- }else if(speedo[i] >= 160 && speedo[i] <= 200){
- if(speedo[i] >= 160 && speedo[i] <= 164){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~�~w~��������", 1000, 3); }
- if(speedo[i] >= 164 && speedo[i] <= 169){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~��~w~�������", 1000, 3); }
- if(speedo[i] >= 169 && speedo[i] <= 173){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~w~������", 1000, 3); }
- if(speedo[i] >= 173 && speedo[i] <= 178){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~�~w~�����", 1000, 3); }
- if(speedo[i] >= 178 && speedo[i] <= 182){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~��~w~����", 1000, 3); }
- if(speedo[i] >= 182 && speedo[i] <= 187){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~w~���", 1000, 3); }
- if(speedo[i] >= 187 && speedo[i] <= 191){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~�~w~��", 1000, 3); }
- if(speedo[i] >= 191 && speedo[i] <= 196){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~��~w~�", 1000, 3); }
- if(speedo[i] >= 196 && speedo[i] <= 200){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~���", 1000, 3); }
- return 1;
- }else if(speedo[i] >= 200 && speedo[i] <= 600){
- if(speedo[i] >= 200 && speedo[i] <= 244){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~�~w~��������", 1000, 3); }
- if(speedo[i] >= 244 && speedo[i] <= 289){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~��~w~�������", 1000, 3); }
- if(speedo[i] >= 289 && speedo[i] <= 333){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~w~������", 1000, 3); }
- if(speedo[i] >= 333 && speedo[i] <= 378){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~�~w~�����", 1000, 3); }
- if(speedo[i] >= 378 && speedo[i] <= 422){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~��~w~����", 1000, 3); }
- if(speedo[i] >= 422 && speedo[i] <= 467){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~w~���", 1000, 3); }
- if(speedo[i] >= 467 && speedo[i] <= 512){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~�~w~��", 1000, 3); }
- if(speedo[i] >= 512 && speedo[i] <= 557){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~��~w~�", 1000, 3); }
- if(speedo[i] >= 557 && speedo[i] <= 600){GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~~g~���~y~���~r~���", 1000, 3); }
- return 1;
- }else if(speedo[i] >= 0 && speedo[i] <= 80 && shift[i] != 1){
- GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT UP", 1000, 3);
- perdervida[i] = 1;
- return 1;
- }else if(speedo[i] >= 80 && speedo[i] <= 120 && shift[i] != 2){
- if(shift[i] == 1) GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT UP", 1000, 3);
- GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT DOWN", 1000, 3);
- perdervida[i] = 1;
- return 1;
- }else if(speedo[i] >= 120 && speedo[i] <= 160 && shift[i] != 3){
- if(shift[i] <= 2) GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT UP", 1000, 3);
- GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT DOWN", 1000, 3);
- perdervida[i] = 1;
- return 1;
- }else if(speedo[i] >= 160 && speedo[i] <= 200 && shift[i] != 4){
- if(shift[i] <= 3) GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT UP", 1000, 3);
- GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT DOWN", 1000, 3);
- perdervida[i] = 1;
- return 1;
- }else if(speedo[i] >= 80 && speedo[i] <= 120 && shift[i] != 5){
- GameTextForPlayer(i, "~n~~n~~n~~n~~n~~b~SHIFT UP", 1000, 3);
- perdervida[i] = 1;
- return 1;
- }
- return 1;
- }
- return 1;
- }
- public TirarVida(playerid,vehicleid)
- {
- if(perdervida[playerid] == 1){
- GetVehicleHealth(vehicleid, VehHealth);
- SetVehicleHealth(vehicleid, VehHealth -5);
- return 1;
- }
- return 1;
- }
- public MatarTempo()
- {
- for(new i=0; i<MAX_PLAYERS; i++) perdervida[i] = 0;
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys & KEY_UP)
- {
- if(shift[playerid] == 5){
- SendClientMessage(playerid,0x21DD00FF,"No more shifts, so your car broke");
- new vehicleid = GetPlayerVehicleID(playerid);
- TirarVida(playerid,vehicleid);
- shift[playerid] = 5;
- return 1;
- }else{
- shift[playerid]++;
- PassarMarcha(playerid);
- return 1;
- }
- }else if(newkeys& KEY_DOWN)
- {
- if(shift[playerid] == 1){
- SendClientMessage(playerid,0x21DD00FF,"You dont have more shifts, so boom");
- new vehicleid = GetPlayerVehicleID(playerid);
- TirarVida(playerid,vehicleid);
- shift[playerid] = 1;
- return 1;
- }else{
- shift[playerid]--;
- PassarMarcha(playerid);
- return 1;
- }
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid,vehicleid)
- {
- shift[playerid] = 1;
- return 1;
- }
- public PassarMarcha(playerid)
- {
- TogglePlayerControllable(playerid, 0);
- SetTimerEx("Destravar", 500, false, "d", playerid);
- return 1;
- }
- public Destravar(playerid)
- {
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement