SA-MP Forums Archive
Hello I have some problems with dealership. - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hello I have some problems with dealership. (/showthread.php?tid=489604)



Hello I have some problems with dealership. - Akcent_Voltaj - 23.01.2014

Hello dear forum members.

I have some problems with sandking and the freeway bike and the rest of cars what can't be modded. Basically it is tuning up without no reason. (like adding nitro and spoilers for it)
Maybe you could give me some points what could be wrong.
Here is saving code:

pawn Код:
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|%d\n",
                            CarInfo[idx][cModel],
                            CarInfo[idx][cLocationx],
                            CarInfo[idx][cLocationy],
                            CarInfo[idx][cLocationz],//26
                            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],
                            CarInfo[idx][cKM]);
                            if(idx == carsonserver)
                            {
                                file2 = fopen("/CASE-BIZ-ETC/masini.cfg", io_write);
                            }
                            else
                            {
                                file2 = fopen("/CASE-BIZ-ETC/masini.cfg", io_append);
                            }
                            fwrite(file2, coordsstring);
                            idx++;
                            fclose(file2);
                        }
                        return 1;
                    }
and here is the cfg how it saves it:

pawn Код:
Freeway,200000,Dealership,1,1,0,1010,0,0,1018,0,0,0,0,0,0,0,1086,0,0,1079,0,-1,256218
Maybe the problem is in /v park command:

pawn Код:
else if(strcmp(x_nr,"park",true) == 0)
                            {
                                new Float:x,Float:y,Float:z;
                                new Float:a;
                                new carid;
                                new getcarid;
                                if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; }
                                else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; }
                                else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { carid = PlayerInfo[playerid][pPcarkey3]; }
                                else { return 1; }
                                getcarid = GetPlayerVehicleID(playerid);
                                GetPlayerName(playerid, playername, sizeof(playername));
                                GetVehiclePos(carid, x, y, z);
                                GetVehicleZAngle(carid, a);
                                if(IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
                                {
                                    if(PlayerInfo[playerid][pPcarkey] == -1 && PlayerInfo[playerid][pPcarkey2] == -1 && PlayerInfo[playerid][pPcarkey3] == -1)
                                    {
                                        SendClientMessage(playerid, COLOR_GREY, "You don't own a car.");
                                        return 1;
                                    }
                                    if(getcarid == carid)
                                    {
                                        new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                                        SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
                                        CarInfo[carid][cLocationx] = x;
                                        CarInfo[carid][cLocationy] = y;
                                        CarInfo[carid][cLocationz] = z;
                                        CarInfo[carid][cAngle] = a;
                                        GetVehicleDamageStatus(carid,panels,doors,lights,tires);
                                        GetVehicleHealth(carid, CarHP); OldCarHP = CarHP;
                                        format(string, sizeof(string), "~n~ You have parked your vehicle in this location. ~n~");
                                        GameTextForPlayer(playerid, "You have parked your vehicle in this position. It will respawn here.", 10000, 3);
                                        OnPropUpdate(); SavePlayerData(playerid);  DestroyVehicle(carid);
                                        CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],-1);
                                        LoadComponents(carid);
                                        PutPlayerInVehicle(playerid,carid,0); SetVehicleHealth(carid, OldCarHP);
                                        UpdateVehicleDamageStatus(carid,panels,doors,lights,tires);
                                        TogglePlayerControllable(playerid, 1);
                                        return 1;
                                    }
                                }
                            }
Thank you for your time and reading my post I'm very pleased for any kind a help...

With best regards Akcent_Voltaj


Re: Hello I have some problems with dealership. - Scrillex - 23.01.2014

Hmmh .. could be some problems when it ain't correctly saving and messing around with another cars.


Re: Hello I have some problems with dealership. - Akcent_Voltaj - 23.01.2014

anyone??


Re: Hello I have some problems with dealership. - Akcent_Voltaj - 24.01.2014

thanks for help everyone..cool forum lots of help