Ejemplo n.º 1
0
    public static void SetModel(string modelName)
    {
        int player    = PLAYER.PLAYER_ID();
        int modelHash = GAMEPLAY.GET_HASH_KEY(modelName);

        STREAMING.REQUEST_MODEL(modelHash);
        int timeOut = 0;

        while (!STREAMING.HAS_MODEL_LOADED(modelHash))
        {
            timeOut++;
            if (timeOut == 5)
            {
                break;
            }
        }
        PLAYER.SET_PLAYER_MODEL(player, modelHash);
        STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(modelHash);
    }
Ejemplo n.º 2
0
    public static int SpawnVehicle(string vehName, bool intoVehicle = true)
    {
        int vehHash = GAMEPLAY.GET_HASH_KEY(vehName);
        int newVec  = 0;

        STREAMING.REQUEST_MODEL(vehHash);
        for (int i = 0; i < 100; i++)
        {
            if (STREAMING.HAS_MODEL_LOADED(vehHash))
            {
                int     playerPed = PLAYER.PLAYER_PED_ID();
                Vector3 myCoords  = GetPosition();
                newVec = VEHICLE.CREATE_VEHICLE(vehHash, myCoords.X, myCoords.Y, myCoords.Z, ENTITY.GET_ENTITY_HEADING(playerPed), true, true);

                if (intoVehicle)
                {
                    PED.SET_PED_INTO_VEHICLE(playerPed, newVec, -1);
                }
                STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(vehHash);
                break;
            }
        }
        return(newVec);
    }