Vehicle becomes invisible inside an interior
#1

So I want to /park my vehicles inside an interior, I'm gonna use it as a garage for roleplay situations.
My problem is when I /park it inside the garage, my car will be disappeared. I mean the car is still there but can't see the vehicle. It's invisible.

How can I fix it up?

Here's my park command

pawn Код:
CMD:park(playerid, params[])
{
    if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
    {
        new ownerid = PlayerInfo[playerid][pVehicleKeysFrom];
        if(IsPlayerConnected(ownerid))
        {
            new d = PlayerInfo[playerid][pVehicleKeys];
            if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[ownerid][d][pvId]))
            {
                if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be in the driver seat.");
                new Float:x, Float:y, Float:z, Float:angle, Float:health;
                GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
                if(health < 800) return SendClientMessage(playerid, COLOR_GREY, " Your vehicle is too damaged to park it.");
                if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
                if(IsARC(GetPlayerVehicleID(playerid))) // RC Vehicles
                {
                    new Float:vehPos[3];
                    GetVehiclePos(GetPlayerVehicleID(playerid),vehPos[0], vehPos[1], vehPos[2]);
                    SetPlayerPos(playerid,vehPos[0], vehPos[1]+0.5, vehPos[2]+0.5);
                }
                GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
                GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
                SurfingCheck(GetPlayerVehicleID(playerid));
                SetVehicleVirtualWorld(pvId, GetPlayerVirtualWorld(playerid));
                LinkVehicleToInterior(pvId, GetPlayerInterior(playerid));
                UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
                PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
                SetPlayerArmedWeapon(playerid, 0);

                new string[29 + (MAX_PLAYER_NAME * 2)];
                format(string, sizeof(string), "* %s has parked %s's vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        }
    }
Reply
#2

Remove this line:
pawn Код:
LinkVehicleToInterior(pvId, GetPlayerInterior(playerid));
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Remove this line:
pawn Код:
LinkVehicleToInterior(pvId, GetPlayerInterior(playerid));
No luck :3
Reply
#4

Show us this:
UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Show us this:
UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
pawn Код:
stock UpdatePlayerVehicleParkPosition(playerid, playervehicleid, Float:newx, Float:newy, Float:newz, Float:newangle, Float:health)
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(PlayerVehicleInfo[playerid][playervehicleid][pvId] != INVALID_PLAYER_VEHICLE_ID)
    {
         new Float:oldx, Float:oldy, Float:oldz;
         oldx = PlayerVehicleInfo[playerid][playervehicleid][pvPosX];
         oldy = PlayerVehicleInfo[playerid][playervehicleid][pvPosY];
         oldz = PlayerVehicleInfo[playerid][playervehicleid][pvPosZ];
         if(oldx == newx && oldy == newy && oldz == newz) return 0;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = newx;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = newy;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = newz;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = newangle;
         UpdatePlayerVehicleMods(playerid, playervehicleid);
         DestroyVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvId]);
         new carcreated = CreateVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvModelId], PlayerVehicleInfo[playerid][playervehicleid][pvPosX], PlayerVehicleInfo[playerid][playervehicleid][pvPosY], PlayerVehicleInfo[playerid][playervehicleid][pvPosZ],
         PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle],PlayerVehicleInfo[playerid][playervehicleid][pvColor1], PlayerVehicleInfo[playerid][playervehicleid][pvColor2], -1);
         PlayerVehicleInfo[playerid][playervehicleid][pvId] = carcreated;
         SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][playervehicleid][pvNumberPlate]);
         SetVehicleHealth(carcreated, health);
         if(PlayerVehicleInfo[playerid][playervehicleid][pvLocked] == 1) LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][playervehicleid][pvId], PlayerVehicleInfo[playerid][playervehicleid][pvLock]);
         LoadPlayerVehicleMods(playerid, playervehicleid);
         return 1;
    }
    return 0;
}
Reply
#6

I don't suppose you have something for interiors/virtual worlds in your PlayerVehicleInfo enum?

Would you mind showing that enum too?
EDIT: Or your loading/saving functions if possible.
Reply
#7

pawn Код:
stock UpdatePlayerVehicleParkPosition(playerid, playervehicleid, Float:newx, Float:newy, Float:newz, Float:newangle, Float:health)
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(PlayerVehicleInfo[playerid][playervehicleid][pvId] != INVALID_PLAYER_VEHICLE_ID)
    {
         new Float:oldx, Float:oldy, Float:oldz;
         oldx = PlayerVehicleInfo[playerid][playervehicleid][pvPosX];
         oldy = PlayerVehicleInfo[playerid][playervehicleid][pvPosY];
         oldz = PlayerVehicleInfo[playerid][playervehicleid][pvPosZ];
         if(oldx == newx && oldy == newy && oldz == newz) return 0;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = newx;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = newy;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = newz;
         PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = newangle;
         UpdatePlayerVehicleMods(playerid, playervehicleid);
         DestroyVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvId]);
         new carcreated = CreateVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvModelId], PlayerVehicleInfo[playerid][playervehicleid][pvPosX], PlayerVehicleInfo[playerid][playervehicleid][pvPosY], PlayerVehicleInfo[playerid][playervehicleid][pvPosZ],
         PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle],PlayerVehicleInfo[playerid][playervehicleid][pvColor1], PlayerVehicleInfo[playerid][playervehicleid][pvColor2], -1);
LinkVehicleToInterior(carcreated, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carcreated, GetPlayerVirtualWorld(playerid));
         PlayerVehicleInfo[playerid][playervehicleid][pvId] = carcreated;
         SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][playervehicleid][pvNumberPlate]);
         SetVehicleHealth(carcreated, health);
         if(PlayerVehicleInfo[playerid][playervehicleid][pvLocked] == 1) LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][playervehicleid][pvId], PlayerVehicleInfo[playerid][playervehicleid][pvLock]);
         LoadPlayerVehicleMods(playerid, playervehicleid);
         return 1;
    }
try the above code
Reply
#8

Quote:
Originally Posted by Threshold
Посмотреть сообщение
I don't suppose you have something for interiors/virtual worlds in your PlayerVehicleInfo enum?

Would you mind showing that enum too?
EDIT: Or your loading/saving functions if possible.
Argh yeah, I don't have anything for interiors/virtual words in PlayerVehicleInfo enum.
is there any way to do it?
Reply
#9

That your problem is, you dont have enums, that why car dont created in virtualworld. Here you go:
pawn Код:
#define MAX_VEHICLES 50

enum cinfo {
pvId,
pvModelId,
pvPosX,
pvPosY,
pvPosZ
}
new PlayerVehicleInfo[MAX_VEHICLES][cinfo]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)