[HELP] vehicle park
#1

I have one problem.
When i type /v parkiraj for parking vehicle, script getting player's position and facing angle, and setting that data into a file. After that, vehicle is destroying and creating with new data, apropos new coords.
So, vehicle creating position is OK and works, but facing angle is very bad.

Look at the images:
http://slike.hr/slike/samp911_7a315.png.html
http://slike.hr/slike/samp912_de4ba.png.html
http://slike.hr/slike/samp913_bca59.png.html

How to fix vehicle facing angle?
Here is my command:
pawn Код:
if(strcmp(tmp, "parkiraj", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                if(PlayerInfo[playerid][pAuto] == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Ne posedujete vozilo!");
                    return 1;
                }
                if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pAuto])
                {
                    new vozilo = PlayerInfo[playerid][pAuto];
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, A);
                    Vozilo[vozilo][hParkX] = X;
                    Vozilo[vozilo][hParkY] = Y;
                    Vozilo[vozilo][hParkZ] = Z;
                    Vozilo[vozilo][hParkA] = A;
                    SacuvajVozilo(vozilo);
                    DestroyVehicle(vozilo);
                    Vozilo[vozilo][ownedvehicle] = CreateVehicle(Vozilo[vozilo][hModel], Vozilo[vozilo][hParkX], Vozilo[vozilo][hParkY], Vozilo[vozilo][hParkZ], Vozilo[vozilo][hParkA], Vozilo[vozilo][hBoja1], Vozilo[vozilo][hBoja2], 300000);
                    SendClientMessage(playerid, COLOR_YELLOW, " > Vozilo parkirano!");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Morate biti u svom vozilu.");
                    return 1;
                }
            }
Sorry for my bad English...
Reply
#2

May I suggest to not destroy vehicle at /park cmd, for better look, store data that car is parked in new place, for example

new NewParkPlace[MAX_VEHICLES];

and when car is parked set this to NewParkPlace[carid] = 1; and OnVehicleSpawn check if this value is 1 and than destroy and create new one, so it would look more realistic that car wont disapearing on /park cmd

like if you Respawn this car or damage till its blowup, on auto respawn car will be at new place.


this /v cmds system is so dumb made overall [ not you just overall ]


This is how Car dealer ship should be made


Here you can check this car dealer in game

193.84.20.19:7777
Reply
#3

Thanks for the advices.
My ownership system was made lik yours, but I had some problems with it. For example, when someone sell their car, car will be destroyed and deleted from file. And car IDs now is mixed. Every car what is buyed after this sold car now have wrong ID.

So, I decided to spawn all vehicles with ownership to avoid this problem.

I will try to make park cmd as you said.

I think that /v cmds system is good. Because, you have 10 cmds in 1. I think it's better than you have 10 different cmds (/park, /locate, /sell, etc).
But, I will make it in dialog


And, I'm solved my problem. I used GetPlayerFacingAngle, but I'm changed that to GetVehicleZAngle.

Thanks for your replay.
Reply
#4

To not make big vehid mix, like make default car settings, for example white landstalker, and create all cars from file far in water, some 3000+ coords, and when someone buy a car, destroy exact car ID from file and create new one, so IDs is correct, well atleast I use like that, I have file for 500 cars, on server start I create them all far in water, and later if someone buy a car, its find first free slot and destroy that car and make new one and store date to file, its actualy more easly than make some strange sys, that car destroying on player disconnect etc.
Reply
#5

chang GetPlayerFacingAngle(playerid, A); to
GetVehicleZAngle(GetPlayerVehicleID(playerid), A);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)