Jump to content
  • 0

Cum pot scoate un sistem de masini personale dintr-un gm


mrtea

Question

Salut.Am gm-ul CorectGaming de pe net si are un sistem de masini personale CGnu poti crea masini sunt la tot coltul.Ma puteti ajuta sal scot?

Va rog sa nu ma criticati recunosc ca sunt noob in scripting dar vreau sa scot acest sistem

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Pai te duci si deschizi gamemode-ul in pawno si faci:

1. Cauti sa vezi cum functioneaza sistemul de masini.(cel mai bine vezi la o comanda de genu /acreatecar sau /v buy sau /buycar sau depinde de gamemode ;) )

[pawn]enum pInfo

{

pKey[128],

pLevel,

pAdmin,

pHelper,

pCrashed,

pPcarkey,

pPcarkey2,

pPcarkey3,

pDonateRank,

gPupgrade

}[/pawn]

2. La mine pe gamemode sistemul functioneaza cu pCarKey si Car_Info {cOwner, cOwner bla bla). Te duci si stergi din enum pInfo { Pass, pAdmin } linia unde este pCarKey sau depinde ce este in gm tau.

3. Dupa te duci la enumeratia (enum {}) unde sunt informatiile despre masini la mine fiind Car_Info Si stergi tot de acolo

[pawn]new carsonserver = 755;

enum cInfo

{

cModel,

Float:cLocationx,

Float:cLocationy,

Float:cLocationz,

Float:cAngle,

cColorOne,

cColorTwo,

cOwner[MAX_PLAYER_NAME],

cDescription[12],

cValue,

cLicense[14],

cRegistration,

cOwned,

cLock,

mod1,

mod2,

mod3,

mod4,

mod5,

mod6,

mod7,

mod8,

mod9,

mod10,

mod11,

mod12,

mod13,

mod14,

mod15,

mod16,

mod17,

paintjob,

};

new CarInfo[1000][cInfo];

[/pawn]

4. Verifici sa stergi tot ce contine pCarKey si cOwned si restu ;)

[pawn]  PlayerInfo[playerid][spawnDance] = true;

    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //preventing a bug for the animation not being applied the first time OnPlayerRequestClass is called

    OnCarUpdate();

    OnPropUpdate();

    PlayerInfo[playerid][pPcarkey] = -1;

PlayerInfo[playerid][pPcarkey2] = -1;

PlayerInfo[playerid][pPcarkey3] = -1;

for(new h = carsonserver; h < sizeof(CarInfo); h++)

{

SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);

}[/pawn]

[pawn] if(IsAnOwnableCar(newcar))

{

    if(CarInfo[newcar][cOwned]==1)

    {

        format(string,sizeof(string),"* Vehiculul privat al jucatorului {ffffff}%s",CarInfo[newcar][cOwner]);

SendClientMessage(playerid, COLOR_ORANGE, string);

if(PlayerInfo[playerid][pPcarkey] == vehicle) { }

else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }

else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }

else

{

    RemovePlayerFromVehicle(playerid);

    SendClientMessage(playerid, COLOR_GREY, "* Nu detii keyle acestei masini.");

}

    }

}[/pawn]

Asta ii de la sistemul de DealerShip care ii pe gm meu.

[pawn]if(listitem==0)

{

                    if (GetPlayerMoney(playerid) >= 100000)

    {

                        GivePlayerMoney(playerid,-100000); //infernus

    new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

                        new thiscar = CreateVehicle(411,X,Y,Z,1,0,0,99999999);

            if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = thiscar; }

                        else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = thiscar; }

                        else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = thiscar; }

            else { return 1; }

            CarInfo[thiscar][cOwned] = 1; CarInfo[thiscar][cModel] = 411; CarInfo[thiscar][cColorOne] = 0; CarInfo[thiscar][cColorTwo] = 0;

            CarInfo[thiscar][cLocationx] = X; CarInfo[thiscar][cLocationy] = Y; CarInfo[thiscar][cLocationz] = Z; CarInfo[thiscar][cAngle] = 1;

        CarInfo[thiscar][cValue] = 90000; CarInfo[thiscar][cLock] = 0; CarInfo[thiscar][paintjob] = -1;

            PutPlayerInVehicle(playerid,thiscar,0); GetPlayerName(playerid, sendername, sizeof(sendername));

            strmid(CarInfo[thiscar][cOwner], sendername, 0, strlen(sendername), 999); PlayerPlayMusic(playerid);

        GameTextForPlayer(playerid, "~w~Felicitari~n~Nu uita sa o parchezi cu /v park!", 5000, 3);

        SendClientMessage(playerid, COLOR_GRAD2, "Felicitari ti-ai cumparat o masina noua!");

        SendClientMessage(playerid, COLOR_GRAD2, "Scrie /v pentru manualul masini!");

        format(CarInfo[thiscar][cDescription], 32, "Infernus"); OnCarUpdate(); SavePlayerData(playerid);

    }

    else { SendClientMessage(playerid, COLOR_WHITE, "  Nu ai suficienti bani pentru a cumpara masina aceasta !"); }[/pawn]

[pawn] new vehid;

vehid = GetPlayerVehicleID(playerid);

if (strcmp(cmd, "/mycars", true) == 0)

{

if(IsPlayerConnected(playerid))

    {

            new carkey = PlayerInfo[playerid][pPcarkey];

    new carkey2 = PlayerInfo[playerid][pPcarkey2];

    new carkey3 = PlayerInfo[playerid][pPcarkey3];

            if (PlayerInfo[playerid][pPcarkey] != -1)

    {

        format(string, sizeof(string), "1| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d]", CarInfo[carkey][cDescription], CarInfo[carkey][cValue], CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock]);

        SendClientMessage(playerid, COLOR_GRAD5,string);

    }

    if (PlayerInfo[playerid][pPcarkey2] != -1)

    {

        format(string, sizeof(string), "2| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d]", CarInfo[carkey2][cDescription], CarInfo[carkey2][cValue], CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock]);

        SendClientMessage(playerid, COLOR_GRAD5,string);

    }

    if (PlayerInfo[playerid][pPcarkey3] != -1)

    {

        format(string, sizeof(string), "3| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d]", CarInfo[carkey3][cDescription], CarInfo[carkey3][cValue], CarInfo[carkey3][cColorOne], CarInfo[carkey3][cColorTwo], CarInfo[carkey3][cLock]);

        SendClientMessage(playerid, COLOR_GRAD5,string);

    }

}

return 1;

}[/pawn]

[pawn]PUBLIC: OnCarUpdate()

{

new idx;

new File: file2;

idx = carsonserver;

while (idx < sizeof(CarInfo))

{

new coordsstring[256];

format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",

CarInfo[idx][cModel],

CarInfo[idx][cLocationx],

CarInfo[idx][cLocationy],

CarInfo[idx][cLocationz],

CarInfo[idx][cAngle],

CarInfo[idx][cColorOne],

CarInfo[idx][cColorTwo],

CarInfo[idx][cOwner],

CarInfo[idx][cDescription],

CarInfo[idx][cValue],

CarInfo[idx][cLicense],

CarInfo[idx][cOwned],

CarInfo[idx][cLock],

CarInfo[idx][mod1],

CarInfo[idx][mod2],

CarInfo[idx][mod3],

CarInfo[idx][mod4],

CarInfo[idx][mod5],

CarInfo[idx][mod6],

CarInfo[idx][mod7],

CarInfo[idx][mod8],

CarInfo[idx][mod9],

CarInfo[idx][mod10],

CarInfo[idx][mod11],

CarInfo[idx][mod12],

CarInfo[idx][mod13],

CarInfo[idx][mod14],

CarInfo[idx][mod15],

CarInfo[idx][mod16],

CarInfo[idx][mod17],

CarInfo[idx][paintjob]);

if(idx == carsonserver)

{

file2 = fopen("personalcars.cfg", io_write);

}

else

{

file2 = fopen("personalcars.cfg", io_append);

}

fwrite(file2, coordsstring);

idx++;

fclose(file2);

}

return 1;

}

PUBLIC: LoadComponents(vehicleid)

{

if(CarInfo[vehicleid][cOwned] == 1)

{

        if(CarInfo[vehicleid][mod1] >= 1000 && CarInfo[vehicleid][mod1] <= 1193)

    {

            if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod1])) != CarInfo[vehicleid][mod1]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod1]); }

        }

    if(CarInfo[vehicleid][mod2] >= 1000 && CarInfo[vehicleid][mod2] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod2])) != CarInfo[vehicleid][mod2]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod2]); }

    }

    if(CarInfo[vehicleid][mod3] >= 1000 && CarInfo[vehicleid][mod3] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod3])) != CarInfo[vehicleid][mod3]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod3]); }

    }

    if(CarInfo[vehicleid][mod4] >= 1000 && CarInfo[vehicleid][mod4] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod4])) != CarInfo[vehicleid][mod4]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod4]); }

    }

    if(CarInfo[vehicleid][mod5] >= 1000 && CarInfo[vehicleid][mod5] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod5])) != CarInfo[vehicleid][mod5]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod5]); }

    }

    if(CarInfo[vehicleid][mod6] >= 1000 && CarInfo[vehicleid][mod6] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod6])) != CarInfo[vehicleid][mod6]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod6]); }

    }

    if(CarInfo[vehicleid][mod7] >= 1000 && CarInfo[vehicleid][mod7] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod7])) != CarInfo[vehicleid][mod7]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod7]); }

    }

    if(CarInfo[vehicleid][mod8] >= 1000 && CarInfo[vehicleid][mod8] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod8])) != CarInfo[vehicleid][mod8]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod8]); }

    }

    if(CarInfo[vehicleid][mod9] >= 1000 && CarInfo[vehicleid][mod9] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod9])) != CarInfo[vehicleid][mod9]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod9]); }

    }

    if(CarInfo[vehicleid][mod10] >= 1000 && CarInfo[vehicleid][mod10] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod10])) != CarInfo[vehicleid][mod10]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod10]); }

    }

    if(CarInfo[vehicleid][mod11] >= 1000 && CarInfo[vehicleid][mod11] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod11])) != CarInfo[vehicleid][mod11]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod11]); }

    }

    if(CarInfo[vehicleid][mod12] >= 1000 && CarInfo[vehicleid][mod12] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod12])) != CarInfo[vehicleid][mod12]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod12]); }

    }

    if(CarInfo[vehicleid][mod13] >= 1000 && CarInfo[vehicleid][mod13] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod13])) != CarInfo[vehicleid][mod13]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod13]); }

    }

    if(CarInfo[vehicleid][mod14] >= 1000 && CarInfo[vehicleid][mod14] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod14])) != CarInfo[vehicleid][mod14]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod14]); }

    }

    if(CarInfo[vehicleid][mod15] >= 1000 && CarInfo[vehicleid][mod15] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod15])) != CarInfo[vehicleid][mod15]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod15]); }

    }

    if(CarInfo[vehicleid][mod16] >= 1000 && CarInfo[vehicleid][mod16] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod16])) != CarInfo[vehicleid][mod16]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod16]); }

    }

    if(CarInfo[vehicleid][mod17] >= 1000 && CarInfo[vehicleid][mod17] <= 1193)

    {

        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod17])) != CarInfo[vehicleid][mod17]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod17]); }

    }

        if(CarInfo[vehicleid][paintjob] > -1) { ChangeVehiclePaintjob(vehicleid,CarInfo[vehicleid][paintjob]); ChangeVehicleColor(vehicleid, 1, 1); }

        else { ChangeVehicleColor(vehicleid, CarInfo[vehicleid][cColorOne], CarInfo[vehicleid][cColorTwo]); }

        if(CarInfo[vehicleid][cLicense] > 0) { SetVehicleNumberPlate(vehicleid,CarInfo[vehicleid][cLicense]); }

    }

    return 1;

}

/*----------Car Save Functions----------*/

PUBLIC: LoadCar()

{

new arrCoords[31][64];

new strFromFile2[256];

new File: file = fopen("personalcars.cfg", io_read);

if (file)

{

new idx = carsonserver;

while (idx < sizeof(CarInfo))

{

fread(file, strFromFile2);

split(strFromFile2, arrCoords, ',');

CarInfo[idx][cModel] = strval(arrCoords[0]);

CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);

CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);

CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);

CarInfo[idx][cAngle] = floatstr(arrCoords[4]);

CarInfo[idx][cColorOne] = strval(arrCoords[5]);

CarInfo[idx][cColorTwo] = strval(arrCoords[6]);

strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);

strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);

CarInfo[idx][cValue] = strval(arrCoords[9]);

strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255);

CarInfo[idx][cOwned] = strval(arrCoords[11]);

CarInfo[idx][cLock] = strval(arrCoords[12]);

CarInfo[idx][mod1] = strval(arrCoords[13]);

CarInfo[idx][mod2] = strval(arrCoords[14]);

CarInfo[idx][mod3] = strval(arrCoords[15]);

CarInfo[idx][mod4] = strval(arrCoords[16]);

CarInfo[idx][mod5] = strval(arrCoords[17]);

CarInfo[idx][mod6] = strval(arrCoords[18]);

CarInfo[idx][mod7] = strval(arrCoords[19]);

CarInfo[idx][mod8] = strval(arrCoords[20]);

CarInfo[idx][mod9] = strval(arrCoords[21]);

CarInfo[idx][mod10] = strval(arrCoords[22]);

CarInfo[idx][mod11] = strval(arrCoords[23]);

CarInfo[idx][mod12] = strval(arrCoords[24]);

CarInfo[idx][mod13] = strval(arrCoords[25]);

CarInfo[idx][mod14] = strval(arrCoords[26]);

CarInfo[idx][mod15] = strval(arrCoords[27]);

CarInfo[idx][mod16] = strval(arrCoords[28]);

CarInfo[idx][mod17] = strval(arrCoords[29]);

CarInfo[idx][paintjob] = strval(arrCoords[30]);

printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);

idx++;

}

}

return 1;

}

PUBLIC: SaveCarCoords()

{

new idx;

new File: file2;

while (idx < sizeof(CarInfo))

{

    new coordsstring[256];

    format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",

CarInfo[idx][cModel],

CarInfo[idx][cLocationx],

CarInfo[idx][cLocationy],

CarInfo[idx][cLocationz],

CarInfo[idx][cAngle],

CarInfo[idx][cColorOne],

CarInfo[idx][cColorTwo],

CarInfo[idx][mod1],

CarInfo[idx][mod2],

CarInfo[idx][mod3],

CarInfo[idx][mod4],

CarInfo[idx][mod5],

CarInfo[idx][mod6],

CarInfo[idx][mod7],

CarInfo[idx][mod8],

CarInfo[idx][mod9],

CarInfo[idx][mod10],

CarInfo[idx][mod11],

CarInfo[idx][mod12],

CarInfo[idx][mod13],

CarInfo[idx][mod14],

CarInfo[idx][mod15],

CarInfo[idx][mod16],

CarInfo[idx][mod17],

CarInfo[idx][paintjob]);

if(idx == carsonserver)

{

file2 = fopen("personalcars.cfg", io_write);

}

else

{

file2 = fopen("personalcars.cfg", io_append);

}

fwrite(file2, coordsstring);

idx++;

fclose(file2);

}

return 1;

}

[/pawn]

Si dupa ce ai verificat sa nu ramana variabile si tot felu de la sistemul de masini Stergi din configuri masinile si tot, ca stau acolo degeaba dupa ;)

Daca ti-am fost de ajutor dami un rep ;)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.