SA-MP Forums Archive
Garage interior. - 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: Garage interior. (/showthread.php?tid=510925)



Garage interior. - Laure - 03.05.2014

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;
}



Re : Garage interior. - Noliax8 - 03.05.2014

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


Re: Garage interior. - Laure - 04.05.2014

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;
}



Re: Garage interior. - superrobot48 - 04.05.2014

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



Re: Garage interior. - Laure - 04.05.2014

didnt work


Re: Garage interior. - superrobot48 - 04.05.2014

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;
}



Re: Garage interior. - Dignity - 04.05.2014

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;
}



Re: Garage interior. - Laure - 04.05.2014

nope didnt work


Re: Garage interior. - PinEvil - 04.05.2014

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..


Re: Garage interior. - Dignity - 04.05.2014

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?