[FilterScript] Cars Machine v1.0
#1


Hey users from SA:MP Fуrum,
I'm new here and become here to show to you my Filter Script - Cars Machine,
this script is util to save Cars and Load then when your script does GMX.



Features:

• Create File Vehicle;
• Delete File Vehicle;
• Choose File Vehicle Color;
• Teleport to File Vehicle;
• Respawn File Vehicle;
• All structure system in Dialog;


ScreensShoots:














PS: Tips and reviews are welcome
(Find bugs? report then please...)

[FilterScript] Download: Cars Machine (amx) Cars Machine (pwn)


[FilterScript] source:
pawn Код:
/*
|                                                                   |
|   Script updated by: Jeffrey_Hatrix, thanks to Willian_Luigi      |
|   to orginal Cars Machine at pastebin.com/HnBePeCp                |
|                                                                   |
*/

#include <a_samp>
#include <SII>
#include <ZCMD>

#define filterScriptUser
#define callCarsDialog 1
#define msgbox DIALOG_STYLE_MSGBOX
#define input DIALOG_STYLE_INPUT
#define list DIALOG_STYLE_LIST

forward wii_CreateCars(playerid, carro, Float:x_, Float:y_, Float:z_, Float:a_);
forward LOAD_CAR();

new Global[128];

enum DATA_CAR {
    file,
    u,
    id,
    c_,
    c2_,
    Float:x,
    Float:y,
    Float:z,
    Float:a
};
new Approppriately[DATA_CAR];

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case callCarsDialog:
            if(response)
            {
                ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
                return 1;
            }
        case 2:
            if(response)
            {
                if(listitem == 0)
                {
                    ShowPlayerDialog(playerid, 3, input, "Cars GUI","\nType a id of a vehicle to create and save\n\n", "Confirm", "Back");
                    return 1;
                }
                else if(listitem == 1)
                {
                    ShowPlayerDialog(playerid, 4, input, "Cars GUI","\nType the id of File to delete the car.\n\n", "Confirm", "Back");
                    return 1;
                }
                else if(listitem == 2)
                {
                    ShowPlayerDialog(playerid, 7, list, "Cars GUI - COLORS", "\nColor 1\nColor 2\n\n", "Confirm", "Back");
                    return 1;
                }
                else if(listitem == 3)
                {
                    ShowPlayerDialog(playerid, 10, input, "Cars GUI - X", "\nType the id File to teleport.\n\n", "Confirm", "Back");
                    return 1;
                }
                else if(listitem == 4)
                {
                    ShowPlayerDialog(playerid, 13, input, "Cars GUI - Spawn", "\nType the id File to respawn\n\n", "Confirm", "Cancel");
                    return 1;
                }
            }
        case 3:
            if(response)
            {
                if(IsPlayerInAnyVehicle(playerid))
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, ALREADY IN A VEHICLE", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

                GetPlayerPos(playerid, Approppriately[x], Approppriately[y], Approppriately[z]);
                GetPlayerFacingAngle(playerid, Approppriately[a]);
                new cc_ = strval(inputtext);
                SetTimerEx("wii_CreateCars", 5000, false, "ddffff", playerid, cc_, Approppriately[x], Approppriately[y], Approppriately[z], Approppriately[a]);
                format(Global, 60, "(WAIT 5 SECONDS) - File car created, id of car: %d", cc_);
                ShowPlayerDialog(playerid, 6, msgbox, "Sucessful", Global, "Continue", "Back");
                TogglePlayerControllable(playerid, 0);
                SetPlayerPos(playerid, Approppriately[x]+2, Approppriately[y], Approppriately[z]);
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 4:
            if(response)
            {
                new cc_ = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", cc_);
                if(!INI_Exist(Global)) return ShowPlayerDialog(playerid, 5, msgbox, "ERROR", "The id from File car doesn't exist, try again.\n\n", "Try", "Cancel");
                INI_Remove(Global);
                format(Global, 45, "File car id[%d] deleted with successful!", cc_);
                ShowPlayerDialog(playerid, 5, msgbox, "Cars GUI", Global, "Delete other", "Cancel");
                DestroyVehicle(cc_);
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 5:
            if(response)
            {
                ShowPlayerDialog(playerid, 4, input, "Cars GUI","\nType the ID File for delete the car\n\n", "Confirm", "Back");
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 6:
            if(!response) return ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 7:
            if(response)
            {
                if(listitem == 0)
                {
                    ShowPlayerDialog(playerid, 8, input, "COR 1", "\nType the id of File car\n\n", "Confirm", "Cancel");
                    return 1;
                }
                else if(listitem == 2)
                {
                    ShowPlayerDialog(playerid, 9, input, "COR 2", "\nType the id of File car\n\n", "Confirm", "Cancel");
                    return 1;
                }
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 8:
            if(response)
            {
                Approppriately[id] = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", Approppriately[id]);
                if(!INI_Exist(Global))
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID ID", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

                ShowPlayerDialog(playerid, 11, input, "COR 1", "\nType the value of color 1 ( 0 - 128 )\n\n", "Confirm", "Cancel");
                return 1;
            }
        case 9:
            if(response)
            {
                Approppriately[id] = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", Approppriately[id]);
                if(!INI_Exist(Global))
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID ID", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

                ShowPlayerDialog(playerid, 12, input, "COR 2", "\nType the value of color 2 ( 0 - 128 )\n\n", "Confirm", "Cancel");
                return 1;
            }
        case 10:
            if(response)
            {
                Approppriately[id] = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", Approppriately[id]);
                if(!INI_Exist(Global))
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID ID", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

                PutPlayerInVehicle(playerid, Approppriately[id], 0);
                ShowPlayerDialog(playerid, 2, list, "Cars GUI - Teleport successful.", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 11:
            if(response)
            {
                if(128 > Approppriately[c_] < 0)
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID VALUE", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

                Approppriately[c_] = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", Approppriately[id]);
                INI_Open(Global);
                INI_WriteInt("Info Cor 1", Approppriately[c_]);
                INI_Save();
                INI_Close();
                ChangeVehicleColor(Approppriately[id], Approppriately[c_], Approppriately[c2_]);
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 12:
            if(response)
            {
                if(128 > Approppriately[c2_] < 0)
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID VALUE", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

                Approppriately[c2_] = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", Approppriately[id]);
                INI_Open(Global);
                INI_WriteInt("Info Cor 2", Approppriately[c2_]);
                INI_Save();
                INI_Close();
                ChangeVehicleColor(Approppriately[id], Approppriately[c_], Approppriately[c2_]);
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        case 13:
            if(response)
            {
                Approppriately[id] = strval(inputtext);
                format(Global, 30, "Cars/%d.ini", Approppriately[id]);
                if(!INI_Exist(Global))
                    return ShowPlayerDialog(playerid, 2, list, "ERROR, ID INVБLIDO", "\nCriar carro\nDeletar carro\nModificar cores\nIr atй carro \"x\"\nRespawn carro \"x\"\n\n", "Confirm", "Cancel");

                SetVehicleToRespawn(Approppriately[id]);
                ShowPlayerDialog(playerid, 2, list, "VEНCULO RESPAWNADO", "\nCriar carro\nDeletar carro\nModificar cores\nIr atй carro \"x\"\nRespawn carro \"x\"\n\n", "Confirm", "Cancel");
                return 1;
            }
            else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");

        default: return false;
    }
    return 1;
}

CMD:carsmachine(playerid) {
    if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid, -1, "You're not an admin Rcon !");
    ShowPlayerDialog(playerid, callCarsDialog, msgbox, "Introduction", "[FS] - by Willian_Luigi, updated by: Jeffrey_Hatrix\n\n", "Continue", "");
    return 1;
}
/*
CMD:ac(playerid, params[]) {
    new id_;
    if(sscanf(params, "d", id_))
        return SendClientMessage(playerid, -1, "Approppriately Use: /ac [id file]");
       
    format(Global, 20, "Cars/%d.ini", id_);
    if(!INI_Exist(Global))
        return SendClientMessage(playerid, -1, "ID inexistente");
       
    INI_Remove(Global);
    format(Global, 30, "Arquivo carro id %d deletado!", id_);
    return 1;
}

CMD:cc(playerid, params[]) {
    new car;
    if(sscanf(params,"d", car))
        return SendClientMessage(playerid, -1, "Approppriately Use: /cc [ID]");

    if(IsPlayerInAnyVehicle(playerid)) {
        GetVehiclePos(GetPlayerVehicleID(playerid), Approppriately[x], Approppriately[y], Approppriately[z]);
        GetVehicleZAngle(GetPlayerVehicleID(playerid), Approppriately[a]);
    }
    else {
        GetPlayerPos(playerid, Approppriately[x], Approppriately[y], Approppriately[z]);
        GetPlayerFacingAngle(playerid, Approppriately[a]);
    }
    if(611 > car > 400)
        return (SetTimerEx("wii_CreateCars", 5000, false, "ddffff",playerid, car, Approppriately[x], Approppriately[y], Approppriately[z], Approppriately[a]));
    SendClientMessage(playerid, -1, "Carro criado com sucesso.");
    return 1;
}*/


public wii_CreateCars(playerid, carro, Float:x_, Float:y_, Float:z_, Float:a_) {
    TogglePlayerControllable(playerid, 1);
    Approppriately[file] ++;
    Approppriately[c_] = random(128);
    Approppriately[c2_] = random(128);
    new ff = CreateVehicle(carro, x_, y_, z_, a_, Approppriately[c_], Approppriately[c2_], 9999999);
    PutPlayerInVehicle(playerid, ff , 0);
    format(Global, 30, "Cars/%d.ini", Approppriately[file]);
    INI_Open(Global);
    INI_WriteInt("Info Car ID", carro);
    INI_WriteInt("Info Car ID GAME", Approppriately[file]);
    INI_WriteFloat("Info Float x", Approppriately[x]);
    INI_WriteFloat("Info Float y", Approppriately[y]);
    INI_WriteFloat("Info Float z", Approppriately[z]);
    INI_WriteFloat("Info Angle", Approppriately[a]);
    INI_WriteInt("Info Cor 1", Approppriately[c_]);
    INI_WriteInt("Info Cor 2", Approppriately[c2_]);
    INI_Save();
    INI_Close();
    strdel(Global, 0, 128);
    INI_Open("Carros/MaxVehicles");
    INI_WriteInt("Veiculos Criados", Approppriately[file]);
    INI_Save();
    INI_Close();
    return 1;
}

public LOAD_CAR() {
    INI_Open("Cars/MaxVehicles");
    Approppriately[id] = INI_ReadInt("Veiculos Criados");
    new n = 1;
    while(n != -1) {
        format(Global, 30, "Cars/%d.ini", n);
        if(!fexist(Global)) break;
        INI_Open(Global);
        Approppriately[id] = INI_ReadInt("Info Car ID GAME");
        Approppriately[u] = INI_ReadInt("Info Car ID");
        Approppriately[x] = INI_ReadFloat("Info Float x");
        Approppriately[y] = INI_ReadFloat("Info Float y");
        Approppriately[z] = INI_ReadFloat("Info Float z");
        Approppriately[a] = INI_ReadFloat("Info Angle");
        Approppriately[c_] = INI_ReadInt("Info Cor 1");
        Approppriately[c2_] = INI_ReadInt("Info Cor 2");
        AddStaticVehicleEx(Approppriately[u], Approppriately[x], Approppriately[y], Approppriately[z], Approppriately[a], Approppriately[c_], Approppriately[c2_], 9999999);
        n++;
    }
    return 1;
}


#if defined filterScriptUser
public OnFilterScriptInit() {
    LOAD_CAR();

    print("\n--------------------------------------\n");
    print("FilterScript vehicleCreator.");
    print("Atual update 1.0 from Jeffrey_Hatrix, thanks to Willian_Luigi");
    printf("Veнculos carregados: %d", Approppriately[id]);
    return print("\n--------------------------------------\n");
}
#else
#error Run this like a FilterScript, By:Willian_Luigi
#endif
[FilterScript] - Cars Machine, original version(Pastebin)

Credits:
Jeffrey_Hatrix, FilterScript
Willian_Luigi, FilterScript idea
Zeex, ZCMD
Slick, SII
Reply


Messages In This Thread
Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 18.03.2012, 16:21
Re: Cars Machine v1.0 - by Georgi166 - 18.03.2012, 16:24
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 18.03.2012, 16:26
Re: Cars Machine v1.0 - by THE_KING$5$ - 18.03.2012, 16:33
Re: Cars Machine v1.0 - by petrolhead - 18.03.2012, 16:43
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 18.03.2012, 16:49
Re: Cars Machine v1.0 - by WLSF - 18.03.2012, 22:32
Re: Cars Machine v1.0 - by Ballu Miaa - 19.03.2012, 02:19
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 19.03.2012, 02:34
Re: Cars Machine v1.0 - by Ballu Miaa - 19.03.2012, 04:18
Re: Cars Machine v1.0 - by Electro[X] - 19.03.2012, 05:30
Re: Cars Machine v1.0 - by Littlehelper - 19.03.2012, 10:12
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 19.03.2012, 14:29
Re: Cars Machine v1.0 - by War Paz - 19.03.2012, 22:12
Re: Cars Machine v1.0 - by Ballu Miaa - 20.03.2012, 02:15
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 20.03.2012, 02:29
Re: Cars Machine v1.0 - by WLSF - 20.03.2012, 14:36
Re: Cars Machine v1.0 - by Ballu Miaa - 20.03.2012, 16:52
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 21.03.2012, 20:29
Re: Cars Machine v1.0 - by Felipe_Wesker - 24.03.2012, 00:22
Respuesta: Cars Machine v1.0 - by LuisGraph - 24.03.2012, 00:28
Re: Cars Machine v1.0 - by J.K - 24.03.2012, 00:38
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 24.03.2012, 01:20
Re: Cars Machine v1.0 - by WLSF - 25.04.2012, 21:45
Re: Cars Machine v1.0 - by Mr_RokKi3[B] - 25.04.2012, 21:57
Re: Cars Machine v1.0 - by xXitsgodzillaXx - 26.04.2012, 01:25
Re: Cars Machine v1.0 - by JAMMIEISFTW - 30.04.2012, 06:01
Re: Cars Machine v1.0 - by Jeffrey_Hatrix Jeffrey_ - 09.05.2012, 11:39

Forum Jump:


Users browsing this thread: 2 Guest(s)