[FilterScript] Parking
#1

Very simple Car-Parking System with saving tuning and all other attributes. New Parking add to cmd. For compile you need this include: https://sampforum.blast.hk/showthread.php?tid=111746



pawn Код:
#include <a_samp>
#include <mxINI05>
// Car Parking by O.K.Style™
#define COLOR_BODY 0xFDE39DFF
enum vInfo {
    vModel,
    Float:vCoordX,
    Float:vCoordY,
    Float:vCoordZ,
    Float:vCoordA,
    vPaintJob,
    vColor1,
    vColor2,
    vModSlot0,
    vModSlot1,
    vModSlot2,
    vModSlot3,
    vModSlot4,
    vModSlot5,
    vModSlot6,
    vModSlot7,
    vModSlot8,
    vModSlot9,
    vModSlot10,
    vModSlot11,
    vModSlot12,
    vModSlot13
};
new VehicleInfo[MAX_VEHICLES][vInfo];

public OnVehicleSpawn(vehicleid)
{
    new string[64];
    format(string, sizeof(string), "parking_%d.ini", vehicleid);
    if(!fexist(string)) return 1;
    new vFile = ini_openFile(string);
    ini_getInteger(vFile, "vModel", VehicleInfo[vehicleid][vModel]);
    ini_getFloat(vFile, "vCoordX", VehicleInfo[vehicleid][vCoordX]);
    ini_getFloat(vFile, "vCoordY", VehicleInfo[vehicleid][vCoordY]);
    ini_getFloat(vFile, "vCoordZ", VehicleInfo[vehicleid][vCoordZ]);
    ini_getFloat(vFile, "vCoordA", VehicleInfo[vehicleid][vCoordA]);
    ini_getInteger(vFile, "vPaintJob", VehicleInfo[vehicleid][vPaintJob]);
    ini_getInteger(vFile, "vColor1", VehicleInfo[vehicleid][vColor1]);
    ini_getInteger(vFile, "vColor2", VehicleInfo[vehicleid][vColor2]);
    ini_getInteger(vFile, "vModSlot0", VehicleInfo[vehicleid][vModSlot0]);
    ini_getInteger(vFile, "vModSlot1", VehicleInfo[vehicleid][vModSlot1]);
    ini_getInteger(vFile, "vModSlot2", VehicleInfo[vehicleid][vModSlot2]);
    ini_getInteger(vFile, "vModSlot3", VehicleInfo[vehicleid][vModSlot3]);
    ini_getInteger(vFile, "vModSlot4", VehicleInfo[vehicleid][vModSlot4]);
    ini_getInteger(vFile, "vModSlot5", VehicleInfo[vehicleid][vModSlot5]);
    ini_getInteger(vFile, "vModSlot6", VehicleInfo[vehicleid][vModSlot6]);
    ini_getInteger(vFile, "vModSlot7", VehicleInfo[vehicleid][vModSlot7]);
    ini_getInteger(vFile, "vModSlot8", VehicleInfo[vehicleid][vModSlot8]);
    ini_getInteger(vFile, "vModSlot9", VehicleInfo[vehicleid][vModSlot9]);
    ini_getInteger(vFile, "vModSlot10", VehicleInfo[vehicleid][vModSlot10]);
    ini_getInteger(vFile, "vModSlot11", VehicleInfo[vehicleid][vModSlot11]);
    ini_getInteger(vFile, "vModSlot12", VehicleInfo[vehicleid][vModSlot12]);
    ini_getInteger(vFile, "vModSlot13", VehicleInfo[vehicleid][vModSlot13]);
    ini_closeFile(vFile);
    SetVehiclePos(vehicleid, VehicleInfo[vehicleid][vCoordX], VehicleInfo[vehicleid][vCoordY], VehicleInfo[vehicleid][vCoordZ]);
    SetVehicleZAngle(vehicleid, VehicleInfo[vehicleid][vCoordA]);
    ChangeVehiclePaintjob(vehicleid, VehicleInfo[vehicleid][vPaintJob]);
    if(VehicleInfo[vehicleid][vColor1] == 0) VehicleInfo[vehicleid][vColor1] = -1;
    if(VehicleInfo[vehicleid][vColor2] == 0) VehicleInfo[vehicleid][vColor2] = -1;
    ChangeVehicleColor(vehicleid, VehicleInfo[vehicleid][vColor1], VehicleInfo[vehicleid][vColor2]);
    if(VehicleInfo[vehicleid][vModSlot0] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot0]);
    if(VehicleInfo[vehicleid][vModSlot1] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot1]);
    if(VehicleInfo[vehicleid][vModSlot2] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot2]);
    if(VehicleInfo[vehicleid][vModSlot3] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot3]);
    if(VehicleInfo[vehicleid][vModSlot4] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot4]);
    if(VehicleInfo[vehicleid][vModSlot5] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot5]);
    if(VehicleInfo[vehicleid][vModSlot6] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot6]);
    if(VehicleInfo[vehicleid][vModSlot7] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot7]);
    if(VehicleInfo[vehicleid][vModSlot8] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot8]);
    if(VehicleInfo[vehicleid][vModSlot9] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot9]);
    if(VehicleInfo[vehicleid][vModSlot10] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot10]);
    if(VehicleInfo[vehicleid][vModSlot11] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot11]);
    if(VehicleInfo[vehicleid][vModSlot12] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot12]);
    if(VehicleInfo[vehicleid][vModSlot13] != 0) AddVehicleComponent(vehicleid, VehicleInfo[vehicleid][vModSlot13]);
    return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    VehicleInfo[vehicleid][vColor1] = color1;
    VehicleInfo[vehicleid][vColor2] = color2;
    return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    VehicleInfo[vehicleid][vPaintJob] = paintjobid;
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/park", true) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid, 25.0, 1082.1635, -1755.7603, 13.5)) return SendClientMessage(playerid, COLOR_BODY, "You are not on the parking.");
        new vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 0) return SendClientMessage(playerid, COLOR_BODY, "You must be in the vehicle.");
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_BODY, "You are not a driver.");
        VehicleInfo[vehicleid][vModel] = GetVehicleModel(vehicleid);
        GetVehiclePos(vehicleid, VehicleInfo[vehicleid][vCoordX], VehicleInfo[vehicleid][vCoordY], VehicleInfo[vehicleid][vCoordZ]);
        GetVehicleZAngle(vehicleid, VehicleInfo[vehicleid][vCoordA]);
        VehicleInfo[vehicleid][vModSlot0] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_SPOILER);
        VehicleInfo[vehicleid][vModSlot1] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_HOOD);
        VehicleInfo[vehicleid][vModSlot2] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_ROOF);
        VehicleInfo[vehicleid][vModSlot3] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_SIDESKIRT);
        VehicleInfo[vehicleid][vModSlot4] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_LAMPS);
        VehicleInfo[vehicleid][vModSlot5] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_NITRO);
        VehicleInfo[vehicleid][vModSlot6] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_EXHAUST);
        VehicleInfo[vehicleid][vModSlot7] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_WHEELS);
        VehicleInfo[vehicleid][vModSlot8] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_STEREO);
        VehicleInfo[vehicleid][vModSlot9] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_HYDRAULICS);
        VehicleInfo[vehicleid][vModSlot10] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_FRONT_BUMPER);
        VehicleInfo[vehicleid][vModSlot11] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_REAR_BUMPER);
        VehicleInfo[vehicleid][vModSlot12] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_VENT_RIGHT);
        VehicleInfo[vehicleid][vModSlot13] = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_VENT_LEFT);
        new string[64];
        format(string, sizeof(string), "parking_%d.ini", vehicleid);
        new vFile = ini_createFile(string);
        if(vFile < 0) vFile = ini_openFile(string);
        if(vFile >= 0)
        {
            ini_setInteger(vFile, "vModel", VehicleInfo[vehicleid][vModel]);
            ini_setFloat(vFile, "vCoordX", VehicleInfo[vehicleid][vCoordX]);
            ini_setFloat(vFile, "vCoordY", VehicleInfo[vehicleid][vCoordY]);
            ini_setFloat(vFile, "vCoordZ", VehicleInfo[vehicleid][vCoordZ]);
            ini_setFloat(vFile, "vCoordA", VehicleInfo[vehicleid][vCoordA]);
            ini_setInteger(vFile, "vPaintJob", VehicleInfo[vehicleid][vPaintJob]);
            ini_setInteger(vFile, "vColor1", VehicleInfo[vehicleid][vColor1]);
            ini_setInteger(vFile, "vColor2", VehicleInfo[vehicleid][vColor2]);
            ini_setInteger(vFile, "vModSlot0", VehicleInfo[vehicleid][vModSlot0]);
            ini_setInteger(vFile, "vModSlot1", VehicleInfo[vehicleid][vModSlot1]);
            ini_setInteger(vFile, "vModSlot2", VehicleInfo[vehicleid][vModSlot2]);
            ini_setInteger(vFile, "vModSlot3", VehicleInfo[vehicleid][vModSlot3]);
            ini_setInteger(vFile, "vModSlot4", VehicleInfo[vehicleid][vModSlot4]);
            ini_setInteger(vFile, "vModSlot5", VehicleInfo[vehicleid][vModSlot5]);
            ini_setInteger(vFile, "vModSlot6", VehicleInfo[vehicleid][vModSlot6]);
            ini_setInteger(vFile, "vModSlot7", VehicleInfo[vehicleid][vModSlot7]);
            ini_setInteger(vFile, "vModSlot8", VehicleInfo[vehicleid][vModSlot8]);
            ini_setInteger(vFile, "vModSlot9", VehicleInfo[vehicleid][vModSlot9]);
            ini_setInteger(vFile, "vModSlot10", VehicleInfo[vehicleid][vModSlot10]);
            ini_setInteger(vFile, "vModSlot11", VehicleInfo[vehicleid][vModSlot11]);
            ini_setInteger(vFile, "vModSlot12", VehicleInfo[vehicleid][vModSlot12]);
            ini_setInteger(vFile, "vModSlot13", VehicleInfo[vehicleid][vModSlot13]);
            ini_closeFile(vFile);
            SendClientMessage(playerid, COLOR_BODY, "You are parked your vehicle.");
            SetVehicleToRespawn(vehicleid);
        }
        else print("Can't open ini-file.");
        return 1;
    }
    return 0;
}
Reply
#2

nice, parking
Reply
#3

Please give the inc Download mxINI05
Reply
#4

Quote:
Originally Posted by Andr293
Посмотреть сообщение
Please give the inc Download mxINI05
http://solidfiles.com/d/d7b10de987/
Reply
#5

Good script with an example of new reading of file INI
(transleted: хороший скрипт с примером нового чтения файла INI )

Quote:
Originally Posted by EvgeN 1137
Посмотреть сообщение
and pastebin link >> http://pastebin.com/KTNpnRbE
Reply
#6

You could save the car's damage, too.
Reply
#7

Quote:
Originally Posted by fordawinzz
Посмотреть сообщение
You could save the car's damage, too.
And some other pararmetrs like open doors, hoods etc. May be in next versions i'm add it.
Reply
#8

Hmm, interesting script. Useful for pawner's to make script faster. Good job bro
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)