*** This topic title sucks, "help me" is not descriptive.
#1

I have a problem with /enter cmd for my garage yeah i can enter it but only when i am not in a car.If i am in a car i cant enter the garage.The Codes.
Код:
	for(new idx=1; idx<MAX_GARAGES; idx++) // Dynamic Garages
	{
		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);
			if(GarageInfo[idx][gLevel] == 1)
			{
   			   SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
	           SetPlayerFacingAngle(playerid, 267.0980);
        	   SetCameraBehindPlayer(playerid);
			   SetPlayerInterior(playerid, 1);
			}
			else if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
               SetVehiclePos(GetPlayerVehicleID(playerid), 1515.2551,-1666.3148,14.0469);
			}
			return 1;

		}
	}
Help will be appreciated.And you will be reputed,Thanks in advance.
Reply
#2

you need IsPlayerInVehicle instead of IsplayerInAnyVehicle because you can define the players car there.
then you also need PutPlayerInVehicle

Basicly you teleport the vehicle and the player appart from eachother and then put the player in the vehicle again with putplayerinvehicle
Reply
#3

Thank you AIped i could learn as well i had the same prob and Imperor as well.
Reply
#4

Your welcome, if its still not working just ask...btw i forgot that you also have to link the vehicle into the interior and put it into the same virtual world. I just saw that Imperor has that implented for the player.
Reply
#5

This time neither i nor the vehicle can enter check out whats wrong now.
Код:
	for(new idx=1; idx<MAX_GARAGES; idx++) // Dynamic Garages
	{
		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);
			if(GarageInfo[idx][gLevel] == 1)
			{
   			   SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
	           SetPlayerFacingAngle(playerid, 267.0980);
        	   SetCameraBehindPlayer(playerid);
			   SetPlayerInterior(playerid, 1);
			}
			else if(IsPlayerInVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
               SetVehiclePos(GetPlayerVehicleID(playerid), 1515.2551,-1666.3148,14.0469);
			}
			return 1;

		}
	}
Reply
#6

this should be the car part see the difference ?
pawn Код:
new yourcar=GetPlayerVehicleID(playerid);
else if(IsPlayerInVehicle(playerid,yourcar)&&GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{

 SetVehiclePos(yourcar 1515.2551,-1666.3148,14.0469);
LinkVehicleToInterior(yourcar,idx+500);//whatever your idx+500 is
SetVehicleVirtualWorld(yourcar,idx+500);
SetPlayerVirtualWorld(playerid, idx+500);
SetPlayerInterior(playerid, idx+500);
PutPlayerInVehicle(yourcar,0);
}
Reply
#7

pawn Код:
for(new idx=1; idx<MAX_GARAGES; idx++) // Dynamic Garages
    {
        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.");
            if(GarageInfo[idx][gLevel] == 1)
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    new veh = GetPlayerVehicleID(playerid);
                    SetVehiclePos(veh, 1515.2551,-1666.3148,14.0469);
                    LinkVehicleToInterior(veh, 1);
                    SetVehicleVirtualWorld(veh,idx+500);
                    SetPlayerVirtualWorld(playerid, idx+500);
                    SetPlayerInterior(playerid, 1);
                }
                else
                {
                    SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
                    SetPlayerFacingAngle(playerid, 267.0980);
                    SetCameraBehindPlayer(playerid);
                    SetPlayerInterior(playerid, 1);
                    SetPlayerVirtualWorld(playerid, idx+500);
                }
                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);
                return 1;
            }
        }
    }
try this...

EDIT CODE UPDATED
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)