/parkcar command help...
#1

Hey so i have been trying to make a park car command but it is just not working as well as i need it to pretty much the first car i park when i log out and log back in its there but if i park more than one car the first car i parked would stay there but the others would not i have no idea how to fix

Please help me

pawn Код:
command(parkcar, playerid, params[])
{
    if(IsPlayerInVehicle(playerid, Player[playerid][CarLinkID]))
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(Player[playerid][CarModDelay] == 0)
            {
                new Float: tmpdamage;
                GetOwnedCarMods(playerid);
                GetVehicleHealth(Player[playerid][CarLinkID], tmpdamage);
                GetVehicleZAngle(Player[playerid][CarLinkID], Player[playerid][CarZAngle]);
                GetVehiclePos(Player[playerid][CarLinkID], Player[playerid][CarX], Player[playerid][CarY], Player[playerid][CarZ]);
                DestroyVehicle(Player[playerid][CarLinkID]);

                OwnedCarCount--;
                CarCount--;

                SpawnOwnedCar(playerid, 1);
                PutPlayerInVehicle(playerid, Player[playerid][CarLinkID], 0);
                Player[playerid][CarModDelay] = 1;
                SetVehicleHealth(Player[playerid][CarLinkID], tmpdamage);
                SavePlayerData(playerid);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Please wait your reload time (60 seconds).");
            }
        }
    }
    if(IsPlayerInVehicle(playerid, Player[playerid][Car2LinkID]))
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(Player[playerid][CarModDelay] == 0)
            {
                new Float: tmpdamage;
                GetOwnedCarMods(playerid);
                GetVehicleHealth(Player[playerid][Car2LinkID], tmpdamage);
                GetVehicleZAngle(Player[playerid][Car2LinkID], Player[playerid][Car2ZAngle]);
                GetVehiclePos(Player[playerid][Car2LinkID], Player[playerid][Car2X], Player[playerid][Car2Y], Player[playerid][Car2Z]);
                DestroyVehicle(Player[playerid][Car2LinkID]);

                OwnedCarCount--;
                CarCount--;

                SpawnOwnedCar(playerid, 2);
                PutPlayerInVehicle(playerid, Player[playerid][Car2LinkID], 0);
                Player[playerid][CarModDelay] = 1;
                SetVehicleHealth(Player[playerid][Car2LinkID], tmpdamage);
                SavePlayerData(playerid);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Please wait your reload time(60 seconds).");
            }
        }
    }
    if(GetPlayerVehicleID(playerid) == Player[playerid][Car3LinkID])
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(Player[playerid][CarModDelay] == 0)
            {
                new Float: tmpdamage;
                GetOwnedCarMods(playerid);
                GetVehicleHealth(Player[playerid][Car3LinkID], tmpdamage);
                GetVehicleZAngle(Player[playerid][Car3LinkID], Player[playerid][Car3ZAngle]);
                GetVehiclePos(Player[playerid][Car3LinkID], Player[playerid][Car3X], Player[playerid][Car3Y], Player[playerid][Car3Z]);
                DestroyVehicle(Player[playerid][Car3LinkID]);

                OwnedCarCount--;
                CarCount--;

                SpawnOwnedCar(playerid, 3);
                PutPlayerInVehicle(playerid, Player[playerid][Car3LinkID], 0);
                Player[playerid][CarModDelay] = 1;
                SetVehicleHealth(Player[playerid][Car3LinkID], tmpdamage);
                SavePlayerData(playerid);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Please wait your reload time (60 seconds).");
            }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "You need to be the driver of this car to do this");
        }
    }
    if(GetPlayerVehicleID(playerid) == Player[playerid][Car4LinkID])
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(Player[playerid][CarModDelay] == 0)
            {
                new Float: tmpdamage;
                GetOwnedCarMods(playerid);
                GetVehicleHealth(Player[playerid][Car4LinkID], tmpdamage);
                GetVehicleZAngle(Player[playerid][Car4LinkID], Player[playerid][Car3ZAngle]);
                GetVehiclePos(Player[playerid][Car4LinkID], Player[playerid][Car4X], Player[playerid][Car4Y], Player[playerid][Car4Z]);
                DestroyVehicle(Player[playerid][Car4LinkID]);

                OwnedCarCount--;
                CarCount--;

                SpawnOwnedCar(playerid, 4);
                PutPlayerInVehicle(playerid, Player[playerid][Car4LinkID], 0);
                Player[playerid][CarModDelay] = 1;
                SetVehicleHealth(Player[playerid][Car4LinkID], tmpdamage);
                SavePlayerData(playerid);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Please wait your reload time (60 seconds).");
            }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "You need to be the driver of this car to do this");
        }
    }
}
I have seen this on my OnPlayerDisconnect

pawn Код:
if(Player[playerid][Authenticated] == 1)
            {
                if(Player[playerid][PlayerCarModel] >= 1)
                {
                    GetOwnedCarMods(playerid);
                    GetVehiclePos(Player[playerid][CarLinkID], Player[playerid][CarX], Player[playerid][CarY], Player[playerid][CarZ]);
                    GetVehicleZAngle(Player[playerid][CarLinkID], Player[playerid][CarZAngle]);
                    DestroyVehicle(Player[playerid][CarLinkID]);
                    Player[playerid][CarLinkID] = 0;
                    OwnedCarCount--;
                    CarCount--;
                }

                if(Player[playerid][PlayerCarModel2] >= 1)
                {
                    GetVehiclePos(Player[playerid][Car2LinkID], Player[playerid][Car2X], Player[playerid][Car2Y], Player[playerid][Car2Z]);
                    GetVehicleZAngle(Player[playerid][Car2LinkID], Player[playerid][Car2ZAngle]);
                    DestroyVehicle(Player[playerid][Car2LinkID]);
                    Player[playerid][Car2LinkID] = 0;
                    OwnedCarCount--;
                    CarCount--;
                }

                if(Player[playerid][PlayerCarModel3] >= 1)
                {
                    GetVehiclePos(Player[playerid][Car3LinkID], Player[playerid][Car3X], Player[playerid][Car3Y], Player[playerid][Car3Z]);
                    GetVehicleZAngle(Player[playerid][Car3LinkID], Player[playerid][Car3ZAngle]);
                    DestroyVehicle(Player[playerid][Car3LinkID]);
                    Player[playerid][Car3LinkID] = 0;
                    OwnedCarCount--;
                    CarCount--;
                }

                if(Player[playerid][PlayerCarModel4] >= 1)
                {
                    GetVehiclePos(Player[playerid][Car4LinkID], Player[playerid][Car4X], Player[playerid][Car4Y], Player[playerid][Car4Z]);
                    GetVehicleZAngle(Player[playerid][Car4LinkID], Player[playerid][Car4ZAngle]);
                    DestroyVehicle(Player[playerid][Car4LinkID]);
                    Player[playerid][Car4LinkID] = 0;
                    OwnedCarCount--;
                    CarCount--;
                }
If you need any more code just ask

Thanks
Reply
#2

Please help
Reply
#3

What is actually wrong with the command? Make you explain in more detail, if it is just a case of the vehicle not saving then try adding a StaticVehicle.
Reply
#4

Quote:
Originally Posted by Cxnnor
Посмотреть сообщение
What is actually wrong with the command? Make you explain in more detail, if it is just a case of the vehicle not saving then try adding a StaticVehicle.
Well when i park all 4 cars only the first one will stay where i parked it after i log out and then back in but when i just drive them and get out and leave them with out parking car they stay there aswell ? I want them all to just stay there when i /parkcar please help me

Thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)