Garage interior.
#1

Hey guys i made a garage system for my server but the problem is i am confused how can i take the vehicle inside the garage yet its only possible for the player to enter the garage heres my command please modify it as so if the players in a vehicle the player enters the garage along with the vehicle
pawn Код:
CMD:entergarage(playerid, params[])
{
    new done, string[128];
    if(IsPlayerInRangeOfPoint(playerid, 3, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
    {
        new idx;
        idx = GetPlayerVirtualWorld(playerid)-500;
        if(!done && idx < MAX_GARAGES && GarageInfo[idx][gLevel])
        {
            format(string, sizeof(string), "** %s pushes the shutter up and exits the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
               SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               SetPlayerInterior(playerid, 1);
            done = 1;
        }
    }
    return 1;
}
Reply
#2

SetPlayerPos is use to teleport a player, but not to teleport a vehicle, use SetVehiclePos, you can retrieve the vehicle ID via GetPlayerVehicleID(playerid) : return ID of the vehicle or 0 if not in a vehicle

Jonas
Reply
#3

I tried it somehow but it still seems not be working here is my pawn hope you guys will modify it as so it works fine.
pawn Код:
CMD:entergarage(playerid, params[])
{
        new idx, vehid, string[128];
        if(IsPlayerInRangeOfPoint(playerid, 2, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
        {
            if(!GarageInfo[idx][gStatus] && PlayerInfo[playerid][pGarage] != idx && PlayerInfo[playerid][pVGarage] != idx) return SendClientMessage(playerid, COLOR_GREY, "This garage is locked by its owner.");
            format(string, sizeof(string), "** %s pushes the shutter and enters the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            SetPlayerVirtualWorld(playerid, idx+500);
            SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
            SetPlayerFacingAngle(playerid, 267.0980);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
           
            if(IsPlayerInVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
               GetPlayerVehicleID(playerid);
               SetVehiclePos(vehid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               SetPlayerInterior(playerid, 1);
               return 1;
            }

        }
        return 1;
}
Reply
#4

its like
pawn Код:
vehid = GetPlayerVehicleID(playerid);
Reply
#5

didnt work
Reply
#6

Try This?
pawn Код:
CMD:entergarage(playerid, params[])
{
        new idx, vehid, string[128];
        if(IsPlayerInRangeOfPoint(playerid, 2, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
        {
            if(!GarageInfo[idx][gStatus] && PlayerInfo[playerid][pGarage] != idx && PlayerInfo[playerid][pVGarage] != idx) return SendClientMessage(playerid, COLOR_GREY, "This garage is locked by its owner.");
            format(string, sizeof(string), "** %s pushes the shutter and enters the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            vehid = GetPlayerVehicleID(playerid);
            SetPlayerVirtualWorld(playerid, idx+500);
            SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
            SetPlayerFacingAngle(playerid, 267.0980);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
           
            if(IsPlayerInVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
               SetVehiclePos(vehid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               SetPlayerInterior(playerid, 1);
               return 1;
            }

        }
        return 1;
}
Reply
#7

pawn Код:
CMD:entergarage(playerid, params[])
{
        new idx, string[128], vehid = GetPlayerVehicleID(playerid);

        if(IsPlayerInRangeOfPoint(playerid, 2, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
        {
            if(!GarageInfo[idx][gStatus] && PlayerInfo[playerid][pGarage] != idx && PlayerInfo[playerid][pVGarage] != idx) return SendClientMessage(playerid, COLOR_GREY, "This garage is locked by its owner.");

            format(string, sizeof(string), "** %s pushes the shutter and enters the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

            if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
            {
                SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
                SetPlayerFacingAngle(playerid, 267.0980);
            }
           
            else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
               SetVehiclePos(vehid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
            }

            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
            SetPlayerVirtualWorld(playerid, idx+500);
        }

        return 1;
}
Reply
#8

nope didnt work
Reply
#9

So you want vehicles able to enter/exit the garage?

If so, You could use check points with vehicle positions attached. And use a progress bar or something to get in with the vehicle..
Reply
#10

Quote:
Originally Posted by Imperor
Посмотреть сообщение
nope didnt work
The code should work. Do you have MAX_GARAGES defined? If so, use a loop and go through it's value instead of defining idx. idx is nothing if you simply do "new idx;"

Quote:
Originally Posted by PinEvil
Посмотреть сообщение
So you want vehicles able to enter/exit the garage?

If so, You could use check points with vehicle positions attached. And use a progress bar or something to get in with the vehicle..
..What?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)