SA-MP Forums Archive
[FilterScript] HandBrake - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] HandBrake (/showthread.php?tid=273304)



HandBrake [ R5 ] - [J]ulian - 01.08.2011

HANDBRAKE
( only functional in the R5 )
Today i bring a filterscript for roleplay server, which acts as a brake of a car stopping in reality this is mobilized.

The only command is /handbrake both to activate and to deactivate it.

Video:

[ame]http://www.youtube.com/watch?v=J08zTeqjid0[/ame]

Pastebin http://pastebin.com/bZEGCeKz


Update:
- With keys:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SUBMISSION) && !(oldkeys & KEY_SUBMISSION))
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            new coche = GetPlayerVehicleID(playerid);
            new nombre[MAX_PLAYER_NAME], string_freno[128], partes[7];
            GetPlayerName(playerid, nombre, sizeof(nombre));
            if(FrenodeMano[coche] == 1)
            {
                FrenodeMano[coche] = 0;
                if(idioma == 0) format(string_freno, sizeof(string_freno), "* %s quitу el freno de mano al vehнculo.", nombre);
                if(idioma == 1) format(string_freno, sizeof(string_freno), "* %s took the hand brake the vehicle.", nombre);
                ProxDetector(30.0, playerid, string_freno, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                GetVehicleParamsEx(coche, partes[0], partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                SetVehicleParamsEx(coche,VEHICLE_PARAMS_ON, partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                return 1;
            }
            if(FrenodeMano[coche] == 0)
            {
                FrenodeMano[coche] = 1;
                GetVehiclePos(coche, VehFrenoPOS[coche][0], VehFrenoPOS[coche][1], VehFrenoPOS[coche][2]);
                GetVehicleZAngle(coche, VehFrenoPOS[coche][3]);
                SetVehicleVelocity(coche, 0, 0, 0);
                if(idioma == 0) format(string_freno, sizeof(string_freno), "* %s colocу el freno de mano al vehнculo.", nombre);
                if(idioma == 1) format(string_freno, sizeof(string_freno), "* %s put the hand brake the vehicle.", nombre);
                ProxDetector(30.0, playerid, string_freno, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                GetVehicleParamsEx(coche, partes[0], partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                SetVehicleParamsEx(coche,VEHICLE_PARAMS_OFF, partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                return 1;
            }
        }
    }
    return 1;
}
Sorry for my English, I am Argentine.

[J]Ulian.


Re: HandBrake - _DownLoaD_ - 01.08.2011

Very nice script, thanx


Re: HandBrake - VoViNaToR - 01.08.2011

Wow awsome, this is good idea for RP, now all cars will be parked corectly.
In chat you typed LAG, is it laggy ?


Respuesta: HandBrake - [J]ulian - 01.08.2011

lag on my bad computer.


Re: HandBrake - gold - 01.08.2011

pawn Код:
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : error 017: undefined symbol "partes"
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : warning 215: expression has no effect
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : error 001: expected token: ";", but found "]"
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : error 029: invalid expression, assumed zero
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : fatal error 107: too many error messages on one line
... help ?
EDIT :
Fixed. cool FS, i will use it


Respuesta: HandBrake - [J]ulian - 01.08.2011

Thank you.


Re: HandBrake - Famalamalam - 01.08.2011

Would be better if you used OnPlayerKeyStateChange to use a key to activate when held down and deactivate when lifted.


Re: HandBrake - VoViNaToR - 01.08.2011

Make it by your self


Re: HandBrake - Famalamalam - 01.08.2011

I would if I had a use for it - I don't, so I won't. What I was saying is it would be better for everyone on earth if that's how it worked, nobody wants to type a command for a handbrake... then type it again to turn it off ...


Respuesta: Re: HandBrake - [J]ulian - 01.08.2011

Quote:
Originally Posted by Famalamalam
Посмотреть сообщение
Would be better if you used OnPlayerKeyStateChange to use a key to activate when held down and deactivate when lifted.
Ok...


Re: HandBrake - TheArcher - 01.08.2011

Quote:
Originally Posted by gold
Посмотреть сообщение
pawn Код:
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : error 017: undefined symbol "partes"
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : warning 215: expression has no effect
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : error 001: expected token: ";", but found "]"
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : error 029: invalid expression, assumed zero
C:\Users\dani\Desktop\RolePlay\RolePlay\gamemodes\RRP.pwn(66478) : fatal error 107: too many error messages on one line
... help ?
EDIT :
Fixed. cool FS, i will use it
Make sure you have the last server update.

P.S The lag might be fixied somehow.


Respuesta: Re: HandBrake - [J]ulian - 02.08.2011

Quote:
Originally Posted by Famalamalam
Посмотреть сообщение
Would be better if you used OnPlayerKeyStateChange to use a key to activate when held down and deactivate when lifted.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SUBMISSION) && !(oldkeys & KEY_SUBMISSION))
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            new coche = GetPlayerVehicleID(playerid);
            new nombre[MAX_PLAYER_NAME], string_freno[128], partes[7];
            GetPlayerName(playerid, nombre, sizeof(nombre));
            if(FrenodeMano[coche] == 1)
            {
                FrenodeMano[coche] = 0;
                if(idioma == 0) format(string_freno, sizeof(string_freno), "* %s quitу el freno de mano al vehнculo.", nombre);
                if(idioma == 1) format(string_freno, sizeof(string_freno), "* %s took the hand brake the vehicle.", nombre);
                ProxDetector(30.0, playerid, string_freno, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                GetVehicleParamsEx(coche, partes[0], partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                SetVehicleParamsEx(coche,VEHICLE_PARAMS_ON, partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                return 1;
            }
            if(FrenodeMano[coche] == 0)
            {
                FrenodeMano[coche] = 1;
                GetVehiclePos(coche, VehFrenoPOS[coche][0], VehFrenoPOS[coche][1], VehFrenoPOS[coche][2]);
                GetVehicleZAngle(coche, VehFrenoPOS[coche][3]);
                SetVehicleVelocity(coche, 0, 0, 0);
                if(idioma == 0) format(string_freno, sizeof(string_freno), "* %s colocу el freno de mano al vehнculo.", nombre);
                if(idioma == 1) format(string_freno, sizeof(string_freno), "* %s put the hand brake the vehicle.", nombre);
                ProxDetector(30.0, playerid, string_freno, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                GetVehicleParamsEx(coche, partes[0], partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                SetVehicleParamsEx(coche,VEHICLE_PARAMS_OFF, partes[1], partes[2], partes[3], partes[4], partes[5], partes[6]);
                return 1;
            }
        }
    }
    return 1;
}



Re: HandBrake - Calgon - 02.08.2011

That's not very realistic, and there's already a handbrake key in GTA: SA.


Respuesta: Re: HandBrake - [J]ulian - 02.08.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
That's not very realistic, and there's already a handbrake key in GTA: SA.
It is for the vehicle will not move while the hand brake.


Re: HandBrake - sherlock - 03.08.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
That's not very realistic, and there's already a handbrake key in GTA: SA.
i think its supposed to be more like real life where you dont have to hold down a button for the car to stay there