Shamal Interior
#1

pawn Код:
new InsideShamal[MAX_PLAYERS];

CMD:window(playerid, params[])
{
    new string[128];
    if(InsideShamal[playerid] != INVALID_VEHICLE_ID)
    {
        if(GetPlayerInterior(playerid) == 1)
        {
            new
                Float: fSpecPos[6];

            GetPlayerPos(playerid, fSpecPos[0], fSpecPos[1], fSpecPos[2]);
            GetPlayerFacingAngle(playerid, fSpecPos[3]);
            GetPlayerHealth(playerid, fSpecPos[4]);
            GetPlayerArmour(playerid, fSpecPos[5]);

            SetPVarFloat(playerid, "air_Xpos", fSpecPos[0]);
            SetPVarFloat(playerid, "air_Ypos", fSpecPos[1]);
            SetPVarFloat(playerid, "air_Zpos", fSpecPos[2]);
            SetPVarFloat(playerid, "air_Rpos", fSpecPos[3]);
            SetPVarFloat(playerid, "air_HP", fSpecPos[4]);
            SetPVarFloat(playerid, "air_Arm", fSpecPos[5]);

            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerSpectating(playerid, 1);
            PlayerSpectateVehicle(playerid, InsideShamal[playerid]);

            format(string, sizeof(string), "* %s glances out the window.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else TogglePlayerSpectating(playerid, 0);
    }
    return 1;
}


new vehicleid = GetPlayerVehicleID(playerid);
    new closestcar = GetClosestCar(playerid, vehicleid);
    if(IsPlayerInRangeOfVehicle(playerid, closestcar, 6.0) && GetVehicleModel(closestcar) == 519)
    {
        if(VehicleStatus{closestcar} == 1) return SendClientMessage(playerid, COLOR_WHITE, "You're not allowed to enter this Shamal as it's been damaged!");
        format(string, sizeof(string), "* %s enters the Shamal airplane as a passenger.", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        SetPlayerPos(playerid, 2.509036, 23.118730, 1199.593750);
        SetPlayerFacingAngle(playerid, 82.14);
        SetCameraBehindPlayer(playerid);
        PlayerInfo[playerid][pVW] = closestcar;
        SetPlayerVirtualWorld(playerid, closestcar);
        PlayerInfo[playerid][pInt] = 1;
        SetPlayerInterior(playerid, 1);
        InsideShamal[playerid] = closestcar;
        SendClientMessage(playerid, COLOR_WHITE, "Type /exit near the door to exit the vehicle, or /window to look outside.");

    }
    return 1;
}

at /exit command

pawn Код:
else if(InsideShamal[playerid] != INVALID_VEHICLE_ID && IsPlayerInRangeOfPoint(playerid,3,2.509036, 23.118730, 1199.593750))
    {
        format(string, sizeof(string), "* %s exits the Shamal airplane.", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

        if(InsideShamal[playerid] == INVALID_VEHICLE_ID || GetVehicleModel(InsideShamal[playerid]) != 519) {
            PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
            GivePlayerValidWeapon(playerid, 46, 60000);
            SetPlayerPos(playerid, 0.000000, 0.000000, 420.000000);
        }
        else {
            new Float:X, Float:Y, Float:Z;
            GetVehiclePos(InsideShamal[playerid], X, Y, Z);
            SetPlayerPos(playerid, X-4, Y-2.3, Z);

            new Float:XB, Float:YB, Float:ZB;
            GetVehiclePos(InsideShamal[playerid], XB, YB, ZB);
            if(ZB > 50.0) {
                PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
                GivePlayerValidWeapon(playerid, 46, 60000);
            }
        }

        PlayerInfo[playerid][pVW] = 0;
        SetPlayerVirtualWorld(playerid, 0);
        PlayerInfo[playerid][pInt] = 0;
        SetPlayerInterior(playerid, 0);
        InsideShamal[playerid] = INVALID_VEHICLE_ID;
    }
    return 1;
}

pawn Код:
InsideShamal[playerid]= INVALID_VEHICLE_ID;

if(PlayerInfo[playerid][pLockCar] != INVALID_VEHICLE_ID)
        vehicle_unlock_doors(PlayerInfo[playerid][pLockCar]);

    if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
        PlayerVehicleInfo[PlayerInfo[playerid][pVehicleKeysFrom]][PlayerInfo[playerid][pVehicleKeys]][pvAllowedPlayerId] = INVALID_PLAYER_ID;

    InsideShamal[playerid] = INVALID_VEHICLE_ID;

    PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);

    GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
    GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);

    if(GetPlayerSkin(playerid) == 155)
        PlayerInfo[playerid][pSkin] = GetPVarInt(playerid, "NPS");

    if(InsideShamal[playerid] != INVALID_VEHICLE_ID) {
        if(InsideShamal[playerid] == INVALID_VEHICLE_ID || GetVehicleModel(InsideShamal[playerid]) != 519)
        {
            GivePlayerValidWeapon(playerid, 46, 60000);
            PlayerInfo[playerid][pPos_x] = 0.000000;
            PlayerInfo[playerid][pPos_y] = 0.000000;
            PlayerInfo[playerid][pPos_z] = 420.000000;
        }
        else
        {
            new Float:X, Float:Y, Float:Z;
            GetVehiclePos(InsideShamal[playerid], X, Y, Z);
            PlayerInfo[playerid][pPos_x] = X;
            PlayerInfo[playerid][pPos_y] = Y;
            PlayerInfo[playerid][pPos_z] = Z;

            new Float:XB, Float:YB, Float:ZB;
            GetVehiclePos(InsideShamal[playerid], XB, YB, ZB);
            if(ZB > 50.0)
            {
                GivePlayerValidWeapon(playerid, 46, 60000);
            }
        }
        PlayerInfo[playerid][pVW] = 0;
        SetPlayerVirtualWorld(playerid, 0);
        PlayerInfo[playerid][pInt] = 0;
        SetPlayerInterior(playerid, 0);
        InsideShamal[playerid] = INVALID_VEHICLE_ID;
    }


public OnPlayerSpawn(playerid) {
    PreloadAnims(playerid);

    if(!gPlayerLogged[playerid])
    {// The player doesn't actually spawn before logging in, this is just to get rid of the annoying "<<", ">>" and "Spawn" buttons in the login/registration screen.
        TogglePlayerControllable(playerid, 0);
        return 1;
    }
    if(InsideShamal[playerid] != INVALID_VEHICLE_ID)
    {
        SetPlayerPos(playerid, GetPVarFloat(playerid, "air_Xpos"), GetPVarFloat(playerid, "air_Ypos"), GetPVarFloat(playerid, "air_Zpos"));
        SetPlayerFacingAngle(playerid, GetPVarFloat(playerid, "air_Rpos"));
        SetPlayerHealth(playerid, GetPVarFloat(playerid, "air_HP"));
        SetPlayerArmourEx(playerid, GetPVarFloat(playerid, "air_Arm"));
        SetPlayerWeaponsEx(playerid);
        SetPlayerToTeamColor(playerid);
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);

        DeletePVar(playerid, "air_Xpos");
        DeletePVar(playerid, "air_Ypos");
        DeletePVar(playerid, "air_Zpos");
        DeletePVar(playerid, "air_Rpos");
        DeletePVar(playerid, "air_HP");
        DeletePVar(playerid, "air_Arm");

        SetCameraBehindPlayer(playerid);
        SetPlayerVirtualWorld(playerid, InsideShamal[playerid]);
        return SetPlayerInterior(playerid, 1);
    }


The Problem is When i Press "G" i can't still enter the Shamal as a Passenger i need Help
Reply


Messages In This Thread
Shamal Interior - by lwilson - 01.06.2014, 02:48
Re: Shamal Interior - by Joshua1 - 01.06.2014, 03:14
Re: Shamal Interior - by Laure - 01.06.2014, 03:18

Forum Jump:


Users browsing this thread: 2 Guest(s)